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.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, Vue, h, Prop, Watch, Emits } from 'vtyx';
|
|
2
2
|
import { unref, reactive, computed, watch } from 'vue';
|
|
3
3
|
|
|
4
4
|
function styleInject(css, ref) {
|
|
@@ -28,7 +28,7 @@ function styleInject(css, ref) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
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";
|
|
31
|
+
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";
|
|
32
32
|
styleInject(css_248z);
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -145,6 +145,12 @@ function compareOptions(oldOptions, newOptions) {
|
|
|
145
145
|
function changeTexts$1(texts) {
|
|
146
146
|
messages = Object.assign(messages, texts);
|
|
147
147
|
}
|
|
148
|
+
function changeIcons$1(newIcons, newFamilyIcon) {
|
|
149
|
+
icons = Object.assign(icons, newIcons);
|
|
150
|
+
if (newFamilyIcon) {
|
|
151
|
+
defaultFamilyIcon = newFamilyIcon;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
148
154
|
/* }}} */
|
|
149
155
|
let messages = {
|
|
150
156
|
noFetchMethod: 'Fetch callback is missing: it is not possible to retrieve data.',
|
|
@@ -165,6 +171,8 @@ let messages = {
|
|
|
165
171
|
unknownPropertyValue: 'property "%s" has incorrect values.',
|
|
166
172
|
wrongQueryResult: 'Query did not return all results.',
|
|
167
173
|
};
|
|
174
|
+
let defaultFamilyIcon = 'selectic';
|
|
175
|
+
let icons = {};
|
|
168
176
|
let closePreviousSelectic;
|
|
169
177
|
/* }}} */
|
|
170
178
|
let uid = 0;
|
|
@@ -182,6 +190,8 @@ class SelecticStore {
|
|
|
182
190
|
childOptions: [],
|
|
183
191
|
groups: [],
|
|
184
192
|
texts: null,
|
|
193
|
+
icons: null,
|
|
194
|
+
iconFamily: null,
|
|
185
195
|
params: {},
|
|
186
196
|
fetchCallback: null,
|
|
187
197
|
getItemsCallback: null,
|
|
@@ -192,47 +202,50 @@ class SelecticStore {
|
|
|
192
202
|
/* }}} */
|
|
193
203
|
/* {{{ data */
|
|
194
204
|
this.state = reactive({
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
placeholder: '',
|
|
198
|
-
hideFilter: false,
|
|
199
|
-
keepFilterOpen: false,
|
|
200
|
-
allowRevert: undefined,
|
|
205
|
+
activeItemIdx: -1,
|
|
206
|
+
allOptions: [],
|
|
201
207
|
allowClearSelection: false,
|
|
202
|
-
|
|
208
|
+
allowRevert: undefined,
|
|
203
209
|
autoDisabled: true,
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
autoSelect: true,
|
|
211
|
+
disabled: false,
|
|
212
|
+
disableGroupSelection: false,
|
|
213
|
+
dynOptions: [],
|
|
214
|
+
filteredOptions: [],
|
|
215
|
+
forceSelectAll: 'auto',
|
|
216
|
+
groups: new Map(),
|
|
217
|
+
hideFilter: false,
|
|
206
218
|
internalValue: null,
|
|
207
219
|
isOpen: false,
|
|
220
|
+
keepFilterOpen: false,
|
|
221
|
+
listPosition: 'auto',
|
|
222
|
+
multiple: false,
|
|
223
|
+
offsetItem: 0,
|
|
224
|
+
optionBehaviorOperation: 'sort',
|
|
225
|
+
optionBehaviorOrder: ['O', 'D', 'E'],
|
|
226
|
+
pageSize: 100,
|
|
227
|
+
placeholder: '',
|
|
208
228
|
searchText: '',
|
|
209
|
-
selectionIsExcluded: false,
|
|
210
|
-
forceSelectAll: 'auto',
|
|
211
|
-
allOptions: [],
|
|
212
|
-
dynOptions: [],
|
|
213
|
-
filteredOptions: [],
|
|
214
229
|
selectedOptions: null,
|
|
230
|
+
selectionIsExcluded: false,
|
|
231
|
+
selectionOverflow: 'collapsed',
|
|
232
|
+
strictValue: false,
|
|
215
233
|
totalAllOptions: Infinity,
|
|
216
234
|
totalDynOptions: Infinity,
|
|
217
235
|
totalFilteredOptions: Infinity,
|
|
218
|
-
groups: new Map(),
|
|
219
|
-
offsetItem: 0,
|
|
220
|
-
activeItemIdx: -1,
|
|
221
|
-
pageSize: 100,
|
|
222
|
-
listPosition: 'auto',
|
|
223
|
-
optionBehaviorOperation: 'sort',
|
|
224
|
-
optionBehaviorOrder: ['O', 'D', 'E'],
|
|
225
236
|
status: {
|
|
226
|
-
searching: false,
|
|
227
|
-
errorMessage: '',
|
|
228
237
|
areAllSelected: false,
|
|
229
|
-
hasChanged: false,
|
|
230
238
|
automaticChange: false,
|
|
231
239
|
automaticClose: false,
|
|
240
|
+
errorMessage: '',
|
|
241
|
+
hasChanged: false,
|
|
242
|
+
searching: false,
|
|
232
243
|
},
|
|
233
244
|
});
|
|
234
245
|
this.data = reactive({
|
|
235
246
|
labels: Object.assign({}, messages),
|
|
247
|
+
icons: Object.assign({}, icons),
|
|
248
|
+
iconFamily: defaultFamilyIcon,
|
|
236
249
|
itemsPerPage: 10,
|
|
237
250
|
doNotUpdate: false,
|
|
238
251
|
cacheItem: new Map(),
|
|
@@ -273,6 +286,9 @@ class SelecticStore {
|
|
|
273
286
|
this.elementOptions = computed(() => {
|
|
274
287
|
return this.getElementOptions();
|
|
275
288
|
});
|
|
289
|
+
this.allowGroupSelection = computed(() => {
|
|
290
|
+
return this.state.multiple && !this.isPartial.value && !this.state.disableGroupSelection;
|
|
291
|
+
});
|
|
276
292
|
/* }}} */
|
|
277
293
|
/* {{{ watch */
|
|
278
294
|
watch(() => [this.props.options, this.props.childOptions], () => {
|
|
@@ -356,6 +372,9 @@ class SelecticStore {
|
|
|
356
372
|
if (this.props.texts) {
|
|
357
373
|
this.changeTexts(this.props.texts);
|
|
358
374
|
}
|
|
375
|
+
if (this.props.icons || this.props.iconFamily) {
|
|
376
|
+
this.changeIcons(this.props.icons, this.props.iconFamily);
|
|
377
|
+
}
|
|
359
378
|
this.addGroups(this.props.groups);
|
|
360
379
|
this.assertValueType();
|
|
361
380
|
this.buildAllOptions();
|
|
@@ -473,17 +492,38 @@ class SelecticStore {
|
|
|
473
492
|
}
|
|
474
493
|
return this.buildSelectedItems(ids);
|
|
475
494
|
}
|
|
495
|
+
selectGroup(id, itemsSelected) {
|
|
496
|
+
const state = this.state;
|
|
497
|
+
if (!unref(this.allowGroupSelection)) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const selectItem = this.selectItem.bind(this);
|
|
501
|
+
let hasChanged = false;
|
|
502
|
+
this.data.doNotUpdate = true;
|
|
503
|
+
const items = state.filteredOptions.filter((item) => {
|
|
504
|
+
const isInGroup = item.group === id && !item.exclusive && !item.disabled;
|
|
505
|
+
if (isInGroup) {
|
|
506
|
+
hasChanged = selectItem(item.id, itemsSelected, true) || hasChanged;
|
|
507
|
+
}
|
|
508
|
+
return isInGroup;
|
|
509
|
+
});
|
|
510
|
+
this.data.doNotUpdate = false;
|
|
511
|
+
if (hasChanged && items.length) {
|
|
512
|
+
this.updateFilteredOptions();
|
|
513
|
+
}
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
476
516
|
selectItem(id, selected, keepOpen = false) {
|
|
477
517
|
const state = this.state;
|
|
478
518
|
let hasChanged = false;
|
|
479
519
|
const item = state.allOptions.find((opt) => opt.id === id);
|
|
480
520
|
/* Check that item is not disabled */
|
|
481
521
|
if (item === null || item === void 0 ? void 0 : item.disabled) {
|
|
482
|
-
return;
|
|
522
|
+
return hasChanged;
|
|
483
523
|
}
|
|
484
524
|
if (state.strictValue && !this.hasValue(id)) {
|
|
485
525
|
/* reject invalid values */
|
|
486
|
-
return;
|
|
526
|
+
return hasChanged;
|
|
487
527
|
}
|
|
488
528
|
if (state.multiple) {
|
|
489
529
|
/* multiple = true */
|
|
@@ -531,12 +571,12 @@ class SelecticStore {
|
|
|
531
571
|
}
|
|
532
572
|
if (!selected) {
|
|
533
573
|
if (id !== oldValue) {
|
|
534
|
-
return;
|
|
574
|
+
return hasChanged;
|
|
535
575
|
}
|
|
536
576
|
id = null;
|
|
537
577
|
}
|
|
538
578
|
else if (id === oldValue) {
|
|
539
|
-
return;
|
|
579
|
+
return hasChanged;
|
|
540
580
|
}
|
|
541
581
|
if (keepOpen) {
|
|
542
582
|
/* if keepOpen is true it means that it is an automatic change */
|
|
@@ -548,6 +588,7 @@ class SelecticStore {
|
|
|
548
588
|
if (hasChanged) {
|
|
549
589
|
state.status.hasChanged = true;
|
|
550
590
|
}
|
|
591
|
+
return hasChanged;
|
|
551
592
|
}
|
|
552
593
|
toggleSelectAll() {
|
|
553
594
|
if (!this.state.multiple) {
|
|
@@ -617,6 +658,14 @@ class SelecticStore {
|
|
|
617
658
|
changeTexts(texts) {
|
|
618
659
|
this.data.labels = Object.assign({}, this.data.labels, texts);
|
|
619
660
|
}
|
|
661
|
+
changeIcons(icons, family) {
|
|
662
|
+
if (icons) {
|
|
663
|
+
this.data.icons = Object.assign({}, this.data.icons, icons);
|
|
664
|
+
}
|
|
665
|
+
if (typeof family === 'string') {
|
|
666
|
+
this.data.iconFamily = family;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
620
669
|
/* }}} */
|
|
621
670
|
/* {{{ private methods */
|
|
622
671
|
hasValue(id) {
|
|
@@ -721,6 +770,7 @@ class SelecticStore {
|
|
|
721
770
|
if (!this.data.doNotUpdate) {
|
|
722
771
|
this.state.filteredOptions = this.buildItems(this.state.filteredOptions);
|
|
723
772
|
this.buildSelectedOptions();
|
|
773
|
+
this.updateGroupSelection();
|
|
724
774
|
}
|
|
725
775
|
}
|
|
726
776
|
addGroups(groups) {
|
|
@@ -728,7 +778,7 @@ class SelecticStore {
|
|
|
728
778
|
this.state.groups.set(group.id, group.text);
|
|
729
779
|
});
|
|
730
780
|
}
|
|
731
|
-
|
|
781
|
+
/** This method is for the computed property listOptions */
|
|
732
782
|
getListOptions() {
|
|
733
783
|
const options = deepClone(this.props.options, ['data']);
|
|
734
784
|
const listOptions = [];
|
|
@@ -879,13 +929,11 @@ class SelecticStore {
|
|
|
879
929
|
/* Do not fetch again just build filteredOptions */
|
|
880
930
|
const search = this.state.searchText;
|
|
881
931
|
if (!search) {
|
|
882
|
-
this.
|
|
883
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
932
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
884
933
|
return;
|
|
885
934
|
}
|
|
886
935
|
const options = this.filterOptions(allOptions, search);
|
|
887
|
-
this.
|
|
888
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
936
|
+
this.setFilteredOptions(options);
|
|
889
937
|
}
|
|
890
938
|
}
|
|
891
939
|
async buildFilteredOptions() {
|
|
@@ -907,13 +955,11 @@ class SelecticStore {
|
|
|
907
955
|
/* Check if all options have been fetched */
|
|
908
956
|
if (hasFetchedAllItems) {
|
|
909
957
|
if (!search) {
|
|
910
|
-
this.
|
|
911
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
958
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
912
959
|
return;
|
|
913
960
|
}
|
|
914
961
|
const options = this.filterOptions(allOptions, search);
|
|
915
|
-
this.
|
|
916
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
962
|
+
this.setFilteredOptions(options);
|
|
917
963
|
return;
|
|
918
964
|
}
|
|
919
965
|
/* When we only have partial options */
|
|
@@ -924,8 +970,7 @@ class SelecticStore {
|
|
|
924
970
|
return;
|
|
925
971
|
}
|
|
926
972
|
if (!search && endIndex <= allOptionsLength) {
|
|
927
|
-
this.
|
|
928
|
-
this.state.totalFilteredOptions = totalAllOptions + this.state.groups.size;
|
|
973
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions), false, totalAllOptions + this.state.groups.size);
|
|
929
974
|
const isPartial = unref(this.isPartial);
|
|
930
975
|
if (isPartial && this.state.totalDynOptions === Infinity) {
|
|
931
976
|
this.fetchData();
|
|
@@ -1039,7 +1084,7 @@ class SelecticStore {
|
|
|
1039
1084
|
/* Added options are the same as previous ones.
|
|
1040
1085
|
* Stop fetching to avoid infinite loop
|
|
1041
1086
|
*/
|
|
1042
|
-
if (!this.hasFetchedAllItems) {
|
|
1087
|
+
if (!unref(this.hasFetchedAllItems)) {
|
|
1043
1088
|
/* Display error if all items are not fetch
|
|
1044
1089
|
* We can have the case where old value and result
|
|
1045
1090
|
* are the same but total is correct when the
|
|
@@ -1063,6 +1108,10 @@ class SelecticStore {
|
|
|
1063
1108
|
const previousItem = state.filteredOptions[filteredOptionsLength - 1];
|
|
1064
1109
|
const options = this.buildGroupItems(result, previousItem);
|
|
1065
1110
|
const nbGroups1 = this.nbGroups(options);
|
|
1111
|
+
/* replace existing options by what have been received
|
|
1112
|
+
* or add received options.
|
|
1113
|
+
* This allow to manage requests received in different orders.
|
|
1114
|
+
*/
|
|
1066
1115
|
state.filteredOptions.splice(offset + dynOffset, limit + nbGroups1, ...options);
|
|
1067
1116
|
}
|
|
1068
1117
|
let nbGroups = state.groups.size;
|
|
@@ -1070,6 +1119,7 @@ class SelecticStore {
|
|
|
1070
1119
|
nbGroups = this.nbGroups(state.filteredOptions);
|
|
1071
1120
|
}
|
|
1072
1121
|
state.totalFilteredOptions = total + nbGroups + dynOffset;
|
|
1122
|
+
this.updateGroupSelection();
|
|
1073
1123
|
if (search && state.totalFilteredOptions <= state.filteredOptions.length) {
|
|
1074
1124
|
this.addStaticFilteredOptions(true);
|
|
1075
1125
|
}
|
|
@@ -1118,8 +1168,7 @@ class SelecticStore {
|
|
|
1118
1168
|
options = this.filterOptions(unref(this.elementOptions), search);
|
|
1119
1169
|
break;
|
|
1120
1170
|
}
|
|
1121
|
-
this.
|
|
1122
|
-
this.state.totalFilteredOptions += options.length;
|
|
1171
|
+
this.setFilteredOptions(options, true);
|
|
1123
1172
|
}
|
|
1124
1173
|
}
|
|
1125
1174
|
buildSelectedItems(ids) {
|
|
@@ -1261,8 +1310,368 @@ class SelecticStore {
|
|
|
1261
1310
|
state.hideFilter = state.totalAllOptions <= this.data.itemsPerPage;
|
|
1262
1311
|
}
|
|
1263
1312
|
}
|
|
1313
|
+
/** update group item, to mark them as selected if needed */
|
|
1314
|
+
updateGroupSelection() {
|
|
1315
|
+
const state = this.state;
|
|
1316
|
+
if (!unref(this.allowGroupSelection)) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const filteredOptions = state.filteredOptions;
|
|
1320
|
+
const groupIdx = new Map();
|
|
1321
|
+
const groupAllSelected = new Map();
|
|
1322
|
+
const groupNbItem = new Map();
|
|
1323
|
+
filteredOptions.forEach((option, idx) => {
|
|
1324
|
+
const groupId = option.group;
|
|
1325
|
+
if (option.isGroup) {
|
|
1326
|
+
const id = option.id;
|
|
1327
|
+
groupIdx.set(id, idx);
|
|
1328
|
+
groupAllSelected.set(id, true);
|
|
1329
|
+
}
|
|
1330
|
+
else if (groupId !== undefined) {
|
|
1331
|
+
if (option.disabled || option.exclusive) {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
groupNbItem.set(groupId, (groupNbItem.get(groupId) || 0) + 1);
|
|
1335
|
+
if (!option.selected) {
|
|
1336
|
+
groupAllSelected.set(groupId, false);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
for (const [id, idx] of groupIdx.entries()) {
|
|
1341
|
+
const group = filteredOptions[idx];
|
|
1342
|
+
group.selected = !!(groupAllSelected.get(id) && groupNbItem.get(id));
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
/** assign new value to the filteredOptions and apply change depending on it */
|
|
1346
|
+
setFilteredOptions(options, add = false, length = 0) {
|
|
1347
|
+
if (!add) {
|
|
1348
|
+
this.state.filteredOptions = options;
|
|
1349
|
+
this.state.totalFilteredOptions = length || options.length;
|
|
1350
|
+
}
|
|
1351
|
+
else {
|
|
1352
|
+
this.state.filteredOptions.push(...options);
|
|
1353
|
+
this.state.totalFilteredOptions += length || options.length;
|
|
1354
|
+
}
|
|
1355
|
+
this.updateGroupSelection();
|
|
1356
|
+
}
|
|
1264
1357
|
}
|
|
1265
1358
|
|
|
1359
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1360
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1361
|
+
*/
|
|
1362
|
+
var __decorate$d = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1363
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1364
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1365
|
+
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;
|
|
1366
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1367
|
+
};
|
|
1368
|
+
let IconCaretDown = class IconCaretDown extends Vue {
|
|
1369
|
+
render() {
|
|
1370
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1371
|
+
h("path", { d: "M7,10L12,15L17,10H7Z" })));
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
IconCaretDown = __decorate$d([
|
|
1375
|
+
Component
|
|
1376
|
+
], IconCaretDown);
|
|
1377
|
+
var IconCaretDown$1 = IconCaretDown;
|
|
1378
|
+
|
|
1379
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1380
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1381
|
+
*/
|
|
1382
|
+
var __decorate$c = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1383
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1384
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1385
|
+
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;
|
|
1386
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1387
|
+
};
|
|
1388
|
+
let IconCaretUp = class IconCaretUp extends Vue {
|
|
1389
|
+
render() {
|
|
1390
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1391
|
+
h("path", { d: "M7,15L12,10L17,15H7Z" })));
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
IconCaretUp = __decorate$c([
|
|
1395
|
+
Component
|
|
1396
|
+
], IconCaretUp);
|
|
1397
|
+
var IconCaretUp$1 = IconCaretUp;
|
|
1398
|
+
|
|
1399
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1400
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1401
|
+
*/
|
|
1402
|
+
var __decorate$b = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1403
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1404
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1405
|
+
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;
|
|
1406
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1407
|
+
};
|
|
1408
|
+
let IconCheck = class IconCheck extends Vue {
|
|
1409
|
+
render() {
|
|
1410
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1411
|
+
h("path", { d: "M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" })));
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
IconCheck = __decorate$b([
|
|
1415
|
+
Component
|
|
1416
|
+
], IconCheck);
|
|
1417
|
+
var IconCheck$1 = IconCheck;
|
|
1418
|
+
|
|
1419
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1420
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1421
|
+
*/
|
|
1422
|
+
var __decorate$a = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1423
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1424
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1425
|
+
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;
|
|
1426
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1427
|
+
};
|
|
1428
|
+
let IconQuestion = class IconQuestion extends Vue {
|
|
1429
|
+
render() {
|
|
1430
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1431
|
+
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" })));
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
IconQuestion = __decorate$a([
|
|
1435
|
+
Component
|
|
1436
|
+
], IconQuestion);
|
|
1437
|
+
var IconQuestion$1 = IconQuestion;
|
|
1438
|
+
|
|
1439
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1440
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1441
|
+
*/
|
|
1442
|
+
var __decorate$9 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1443
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1444
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1445
|
+
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;
|
|
1446
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1447
|
+
};
|
|
1448
|
+
let IconSearch = class IconSearch extends Vue {
|
|
1449
|
+
render() {
|
|
1450
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1451
|
+
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" })));
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
IconSearch = __decorate$9([
|
|
1455
|
+
Component
|
|
1456
|
+
], IconSearch);
|
|
1457
|
+
var IconSearch$1 = IconSearch;
|
|
1458
|
+
|
|
1459
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1460
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1461
|
+
*/
|
|
1462
|
+
var __decorate$8 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1463
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1464
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1465
|
+
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;
|
|
1466
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1467
|
+
};
|
|
1468
|
+
let IconSpinner = class IconSpinner extends Vue {
|
|
1469
|
+
render() {
|
|
1470
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1471
|
+
h("path", { d: "M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z" })));
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
IconSpinner = __decorate$8([
|
|
1475
|
+
Component
|
|
1476
|
+
], IconSpinner);
|
|
1477
|
+
var IconSpinner$1 = IconSpinner;
|
|
1478
|
+
|
|
1479
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1480
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1481
|
+
*/
|
|
1482
|
+
var __decorate$7 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1483
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1484
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1485
|
+
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;
|
|
1486
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1487
|
+
};
|
|
1488
|
+
let IconStrikeThrough = class IconStrikeThrough extends Vue {
|
|
1489
|
+
render() {
|
|
1490
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1491
|
+
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" })));
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
IconStrikeThrough = __decorate$7([
|
|
1495
|
+
Component
|
|
1496
|
+
], IconStrikeThrough);
|
|
1497
|
+
var IconStrikeThrough$1 = IconStrikeThrough;
|
|
1498
|
+
|
|
1499
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1500
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1501
|
+
*/
|
|
1502
|
+
var __decorate$6 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1503
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1504
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1505
|
+
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;
|
|
1506
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1507
|
+
};
|
|
1508
|
+
let IconTimes = class IconTimes extends Vue {
|
|
1509
|
+
render() {
|
|
1510
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1511
|
+
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" })));
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
IconTimes = __decorate$6([
|
|
1515
|
+
Component
|
|
1516
|
+
], IconTimes);
|
|
1517
|
+
var IconTimes$1 = IconTimes;
|
|
1518
|
+
|
|
1519
|
+
/* File Purpose:
|
|
1520
|
+
* Display the wanted icon.
|
|
1521
|
+
*/
|
|
1522
|
+
var __decorate$5 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1523
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1524
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1525
|
+
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;
|
|
1526
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1527
|
+
};
|
|
1528
|
+
let Icon = class Icon extends Vue {
|
|
1529
|
+
/* }}} */
|
|
1530
|
+
/* {{{ computed */
|
|
1531
|
+
get rawIconValue() {
|
|
1532
|
+
const key = this.icon;
|
|
1533
|
+
const icon = this.store.data.icons[key];
|
|
1534
|
+
if (icon === undefined) {
|
|
1535
|
+
return key;
|
|
1536
|
+
}
|
|
1537
|
+
return icon;
|
|
1538
|
+
}
|
|
1539
|
+
get family() {
|
|
1540
|
+
const iconValue = this.rawIconValue;
|
|
1541
|
+
if (iconValue.startsWith('selectic:')) {
|
|
1542
|
+
return 'selectic';
|
|
1543
|
+
}
|
|
1544
|
+
if (iconValue.startsWith('raw:')) {
|
|
1545
|
+
return 'raw';
|
|
1546
|
+
}
|
|
1547
|
+
return this.store.data.iconFamily;
|
|
1548
|
+
}
|
|
1549
|
+
get iconValue() {
|
|
1550
|
+
const key = this.rawIconValue;
|
|
1551
|
+
if (key.includes(':')) {
|
|
1552
|
+
/* This is to retrieve value from string such as
|
|
1553
|
+
* 'selectic:spinner:spin' (and get only 'spinner') */
|
|
1554
|
+
const value = key.split(':');
|
|
1555
|
+
return value[1];
|
|
1556
|
+
}
|
|
1557
|
+
return key;
|
|
1558
|
+
}
|
|
1559
|
+
get vueIcon() {
|
|
1560
|
+
switch (this.icon) {
|
|
1561
|
+
case 'caret-down':
|
|
1562
|
+
return IconCaretDown$1;
|
|
1563
|
+
case 'caret-up':
|
|
1564
|
+
return IconCaretUp$1;
|
|
1565
|
+
case 'check':
|
|
1566
|
+
return IconCheck$1;
|
|
1567
|
+
case 'search':
|
|
1568
|
+
return IconSearch$1;
|
|
1569
|
+
case 'spinner':
|
|
1570
|
+
return IconSpinner$1;
|
|
1571
|
+
case 'strikethrough':
|
|
1572
|
+
return IconStrikeThrough$1;
|
|
1573
|
+
case 'times':
|
|
1574
|
+
return IconTimes$1;
|
|
1575
|
+
case 'question':
|
|
1576
|
+
default:
|
|
1577
|
+
return IconQuestion$1;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
get spinClass() {
|
|
1581
|
+
var _a;
|
|
1582
|
+
let value = this.store.data.icons.spin;
|
|
1583
|
+
if (typeof value === 'string') {
|
|
1584
|
+
if (value.startsWith('selectic:')) {
|
|
1585
|
+
return 'selectic-spin';
|
|
1586
|
+
}
|
|
1587
|
+
if (value.includes(':')) {
|
|
1588
|
+
value = (_a = value.split(':')[1]) !== null && _a !== void 0 ? _a : 'spin';
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
else {
|
|
1592
|
+
value = 'spin';
|
|
1593
|
+
}
|
|
1594
|
+
const family = this.family;
|
|
1595
|
+
let prefix = '';
|
|
1596
|
+
switch (family) {
|
|
1597
|
+
case 'font-awesome-4':
|
|
1598
|
+
prefix = 'fa-';
|
|
1599
|
+
break;
|
|
1600
|
+
case 'font-awesome-5':
|
|
1601
|
+
prefix = 'fa-';
|
|
1602
|
+
break;
|
|
1603
|
+
case 'font-awesome-6':
|
|
1604
|
+
prefix = 'fa-';
|
|
1605
|
+
break;
|
|
1606
|
+
case '':
|
|
1607
|
+
case 'selectic':
|
|
1608
|
+
prefix = 'selectic-';
|
|
1609
|
+
break;
|
|
1610
|
+
case 'raw':
|
|
1611
|
+
prefix = '';
|
|
1612
|
+
break;
|
|
1613
|
+
default:
|
|
1614
|
+
prefix = 'selectic-';
|
|
1615
|
+
}
|
|
1616
|
+
return `${prefix}${value}`;
|
|
1617
|
+
}
|
|
1618
|
+
get spinActive() {
|
|
1619
|
+
return this.spin || this.rawIconValue.endsWith(':spin');
|
|
1620
|
+
}
|
|
1621
|
+
/* }}} */
|
|
1622
|
+
renderInnerIcon() {
|
|
1623
|
+
const component = this.vueIcon;
|
|
1624
|
+
return h(component, {
|
|
1625
|
+
class: {
|
|
1626
|
+
'selectic__icon': true,
|
|
1627
|
+
[this.spinClass]: this.spinActive,
|
|
1628
|
+
},
|
|
1629
|
+
title: this.title,
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
renderSpanIcon(prefix) {
|
|
1633
|
+
const classSpin = this.spinActive && this.spinClass || '';
|
|
1634
|
+
return (h("span", { class: `${prefix}${this.iconValue} ${classSpin}`, title: this.title }));
|
|
1635
|
+
}
|
|
1636
|
+
render() {
|
|
1637
|
+
const family = this.family;
|
|
1638
|
+
switch (family) {
|
|
1639
|
+
case '':
|
|
1640
|
+
case 'selectic':
|
|
1641
|
+
return this.renderInnerIcon();
|
|
1642
|
+
case 'font-awesome-4':
|
|
1643
|
+
return this.renderSpanIcon('fa fa-fw fa-');
|
|
1644
|
+
case 'font-awesome-5':
|
|
1645
|
+
return this.renderSpanIcon('fas fa-fw fa-');
|
|
1646
|
+
case 'font-awesome-4':
|
|
1647
|
+
return this.renderSpanIcon('fa-solid fa-fw fa-');
|
|
1648
|
+
case 'raw':
|
|
1649
|
+
return this.renderSpanIcon('');
|
|
1650
|
+
default:
|
|
1651
|
+
if (family.startsWith('prefix:')) {
|
|
1652
|
+
return this.renderSpanIcon(family.slice(7));
|
|
1653
|
+
}
|
|
1654
|
+
return this.renderInnerIcon();
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
__decorate$5([
|
|
1659
|
+
Prop()
|
|
1660
|
+
], Icon.prototype, "store", void 0);
|
|
1661
|
+
__decorate$5([
|
|
1662
|
+
Prop()
|
|
1663
|
+
], Icon.prototype, "icon", void 0);
|
|
1664
|
+
__decorate$5([
|
|
1665
|
+
Prop()
|
|
1666
|
+
], Icon.prototype, "spin", void 0);
|
|
1667
|
+
__decorate$5([
|
|
1668
|
+
Prop()
|
|
1669
|
+
], Icon.prototype, "title", void 0);
|
|
1670
|
+
Icon = __decorate$5([
|
|
1671
|
+
Component
|
|
1672
|
+
], Icon);
|
|
1673
|
+
var Icon$1 = Icon;
|
|
1674
|
+
|
|
1266
1675
|
/* File Purpose:
|
|
1267
1676
|
* It displays the core element which is always visible (where selection is
|
|
1268
1677
|
* displayed) and handles all interaction with it.
|
|
@@ -1527,16 +1936,16 @@ let MainInput = class MainInput extends Vue {
|
|
|
1527
1936
|
'selectic-item_text',
|
|
1528
1937
|
], title: this.store.state.placeholder }, this.store.state.placeholder)),
|
|
1529
1938
|
this.store.state.multiple && (h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
|
|
1530
|
-
this.isSelectionReversed && (h("
|
|
1939
|
+
this.isSelectionReversed && (h(Icon$1, { icon: "strikethrough", store: this.store, class: "selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
|
|
1531
1940
|
this.showSelectedOptions.map((item) => (h("div", { class: "single-value", style: item.style, title: item.title || item.text, on: {
|
|
1532
1941
|
click: () => this.$emit('item:click', item.id),
|
|
1533
1942
|
} },
|
|
1534
1943
|
h("span", { class: "selectic-input__selected-items__value" }, item.text),
|
|
1535
|
-
!this.isDisabled && (h(
|
|
1944
|
+
!this.isDisabled && (h(Icon$1, { icon: "times", class: "selectic-input__selected-items__icon", store: this.store, on: {
|
|
1536
1945
|
'click.prevent.stop': () => this.selectItem(item.id),
|
|
1537
1946
|
} }))))),
|
|
1538
1947
|
this.moreSelectedNb && (h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
|
|
1539
|
-
this.showClearAll && (h(
|
|
1948
|
+
this.showClearAll && (h(Icon$1, { icon: "times", class: "selectic-input__clear-icon", title: this.clearedLabel, store: this.store, on: { 'click.prevent.stop': this.clearSelection } }))),
|
|
1540
1949
|
h("div", { class: [
|
|
1541
1950
|
'selectic__icon-container',
|
|
1542
1951
|
'form-control-feedback',
|
|
@@ -1544,7 +1953,7 @@ let MainInput = class MainInput extends Vue {
|
|
|
1544
1953
|
], on: {
|
|
1545
1954
|
'click.prevent.stop': () => this.toggleFocus(),
|
|
1546
1955
|
} },
|
|
1547
|
-
h(
|
|
1956
|
+
h(Icon$1, { icon: "caret-down", class: "selectic-icon", store: this.store }))));
|
|
1548
1957
|
}
|
|
1549
1958
|
};
|
|
1550
1959
|
__decorate$4([
|
|
@@ -1692,7 +2101,7 @@ let FilterPanel = class FilterPanel extends Vue {
|
|
|
1692
2101
|
h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: state.searchText, on: {
|
|
1693
2102
|
'input.stop.prevent': this.onInput,
|
|
1694
2103
|
}, ref: "filterInput" }),
|
|
1695
|
-
h("
|
|
2104
|
+
h(Icon$1, { icon: "search", store: this.store, class: "selectic-search-scope form-control-feedback" })),
|
|
1696
2105
|
state.multiple && (h("div", { class: "toggle-selectic" },
|
|
1697
2106
|
h("label", { class: ['control-label', {
|
|
1698
2107
|
'selectic__label-disabled': this.disableSelectAll,
|
|
@@ -1712,12 +2121,8 @@ let FilterPanel = class FilterPanel extends Vue {
|
|
|
1712
2121
|
!state.keepFilterOpen && (h("div", { class: "curtain-handler", on: {
|
|
1713
2122
|
'click.prevent.stop': this.togglePanel,
|
|
1714
2123
|
} },
|
|
1715
|
-
h(
|
|
1716
|
-
h(
|
|
1717
|
-
'fa': true,
|
|
1718
|
-
'fa-caret-down': this.closed,
|
|
1719
|
-
'fa-caret-up': !this.closed,
|
|
1720
|
-
} })))));
|
|
2124
|
+
h(Icon$1, { icon: "search", store: this.store }),
|
|
2125
|
+
h(Icon$1, { icon: this.closed ? 'caret-down' : 'caret-up', store: this.store })))));
|
|
1721
2126
|
}
|
|
1722
2127
|
};
|
|
1723
2128
|
__decorate$3([
|
|
@@ -1777,7 +2182,7 @@ let List = class List extends Vue {
|
|
|
1777
2182
|
text: '',
|
|
1778
2183
|
disabled: true,
|
|
1779
2184
|
selected: false,
|
|
1780
|
-
icon: '
|
|
2185
|
+
icon: 'current:spinner:spin',
|
|
1781
2186
|
isGroup: false,
|
|
1782
2187
|
});
|
|
1783
2188
|
}
|
|
@@ -1827,7 +2232,11 @@ let List = class List extends Vue {
|
|
|
1827
2232
|
/* }}} */
|
|
1828
2233
|
/* {{{ methods */
|
|
1829
2234
|
click(option) {
|
|
1830
|
-
if (option.disabled
|
|
2235
|
+
if (option.disabled) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
if (option.isGroup) {
|
|
2239
|
+
this.store.selectGroup(option.id, !option.selected);
|
|
1831
2240
|
return;
|
|
1832
2241
|
}
|
|
1833
2242
|
this.store.selectItem(option.id);
|
|
@@ -1915,14 +2324,17 @@ let List = class List extends Vue {
|
|
|
1915
2324
|
'mouseover': () => this.onMouseOver(idx),
|
|
1916
2325
|
}, class: ['selectic-item', option.className || '', {
|
|
1917
2326
|
'selected': option.selected,
|
|
2327
|
+
'selectable': unref(this.store.allowGroupSelection) && option.isGroup && !option.disabled,
|
|
1918
2328
|
'selectic-item__active': idx + this.startIndex === this.store.state.activeItemIdx,
|
|
1919
2329
|
'selectic-item__disabled': !!option.disabled,
|
|
1920
2330
|
'selectic-item__exclusive': !!option.exclusive,
|
|
1921
2331
|
'selectic-item__is-in-group': !!option.group,
|
|
1922
2332
|
'selectic-item__is-group': option.isGroup,
|
|
1923
2333
|
}], style: option.style, title: option.title, key: 'selectic-item-' + (idx + this.startIndex) },
|
|
1924
|
-
this.isMultiple && (h(
|
|
1925
|
-
option.icon && (
|
|
2334
|
+
this.isMultiple && (h(Icon$1, { icon: "check", store: this.store, class: "selectic-item_icon" })),
|
|
2335
|
+
option.icon && (option.icon.includes(':')
|
|
2336
|
+
? h(Icon$1, { icon: option.icon, store: this.store })
|
|
2337
|
+
: h(Icon$1, { icon: `raw:${option.icon}`, store: this.store })),
|
|
1926
2338
|
option.text))),
|
|
1927
2339
|
!!this.bottomOffset && (h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` })))));
|
|
1928
2340
|
}
|
|
@@ -1967,7 +2379,8 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
1967
2379
|
super(...arguments);
|
|
1968
2380
|
/* }}} */
|
|
1969
2381
|
/* {{{ data */
|
|
1970
|
-
this.
|
|
2382
|
+
this.topGroupName = ' ';
|
|
2383
|
+
this.topGroupId = null;
|
|
1971
2384
|
this.listHeight = 0;
|
|
1972
2385
|
this.listWidth = 200;
|
|
1973
2386
|
this.availableSpace = 0;
|
|
@@ -2111,6 +2524,24 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2111
2524
|
--availableSpace: ${availableSpace}px;
|
|
2112
2525
|
`;
|
|
2113
2526
|
}
|
|
2527
|
+
get topGroup() {
|
|
2528
|
+
const topGroupId = this.topGroupId;
|
|
2529
|
+
if (!topGroupId) {
|
|
2530
|
+
return undefined;
|
|
2531
|
+
}
|
|
2532
|
+
const group = this.store.state.filteredOptions.find((option) => {
|
|
2533
|
+
return option.id === topGroupId;
|
|
2534
|
+
});
|
|
2535
|
+
return group;
|
|
2536
|
+
}
|
|
2537
|
+
get topGroupSelected() {
|
|
2538
|
+
const group = this.topGroup;
|
|
2539
|
+
return !!(group === null || group === void 0 ? void 0 : group.selected);
|
|
2540
|
+
}
|
|
2541
|
+
get topGroupDisabled() {
|
|
2542
|
+
const group = this.topGroup;
|
|
2543
|
+
return !!(group === null || group === void 0 ? void 0 : group.disabled);
|
|
2544
|
+
}
|
|
2114
2545
|
/* }}} */
|
|
2115
2546
|
/* {{{ watch */
|
|
2116
2547
|
onFilteredOptionsChange() {
|
|
@@ -2124,13 +2555,17 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2124
2555
|
getGroup(id) {
|
|
2125
2556
|
const group = this.store.state.groups.get(id);
|
|
2126
2557
|
const groupName = group || ' ';
|
|
2127
|
-
this.
|
|
2558
|
+
this.topGroupName = groupName;
|
|
2559
|
+
this.topGroupId = id;
|
|
2128
2560
|
}
|
|
2129
2561
|
computeListSize() {
|
|
2130
2562
|
const box = this.$el.getBoundingClientRect();
|
|
2131
2563
|
this.listHeight = box.height;
|
|
2132
2564
|
this.listWidth = box.width;
|
|
2133
2565
|
}
|
|
2566
|
+
clickHeaderGroup() {
|
|
2567
|
+
this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
|
|
2568
|
+
}
|
|
2134
2569
|
/* }}} */
|
|
2135
2570
|
/* {{{ Life cycles */
|
|
2136
2571
|
mounted() {
|
|
@@ -2156,13 +2591,24 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2156
2591
|
`selectic-position-${this.position}`,
|
|
2157
2592
|
] },
|
|
2158
2593
|
!state.hideFilter && (h(Filter, { store: this.store })),
|
|
2159
|
-
isGroup && (h("span", { class:
|
|
2594
|
+
isGroup && (h("span", { class: [
|
|
2595
|
+
'selectic-item selectic-item--header selectic-item__is-group',
|
|
2596
|
+
{
|
|
2597
|
+
selected: this.topGroupSelected,
|
|
2598
|
+
selectable: unref(this.store.allowGroupSelection) && !this.topGroupDisabled,
|
|
2599
|
+
disabled: this.topGroupDisabled,
|
|
2600
|
+
},
|
|
2601
|
+
], on: {
|
|
2602
|
+
click: () => this.clickHeaderGroup(),
|
|
2603
|
+
} },
|
|
2604
|
+
this.topGroupSelected && (h(Icon$1, { icon: "check", store: this.store, class: "selectic-item_icon" })),
|
|
2605
|
+
this.topGroupName)),
|
|
2160
2606
|
h(List$1, { store: store, on: {
|
|
2161
2607
|
groupId: this.getGroup,
|
|
2162
2608
|
} }),
|
|
2163
2609
|
this.infoMessage && (h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
|
|
2164
2610
|
this.searching && (h("div", { class: "selectic__message" },
|
|
2165
|
-
h(
|
|
2611
|
+
h(Icon$1, { icon: "spinner", store: this.store, spin: true }),
|
|
2166
2612
|
this.searchingLabel)),
|
|
2167
2613
|
this.errorMessage && (h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
|
|
2168
2614
|
}
|
|
@@ -2211,6 +2657,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
2211
2657
|
function changeTexts(texts) {
|
|
2212
2658
|
changeTexts$1(texts);
|
|
2213
2659
|
}
|
|
2660
|
+
function changeIcons(icons, iconFamily) {
|
|
2661
|
+
changeIcons$1(icons, iconFamily);
|
|
2662
|
+
}
|
|
2214
2663
|
let Selectic = class Selectic extends Vue {
|
|
2215
2664
|
constructor() {
|
|
2216
2665
|
super(...arguments);
|
|
@@ -2299,15 +2748,19 @@ let Selectic = class Selectic extends Vue {
|
|
|
2299
2748
|
/* }}} */
|
|
2300
2749
|
/* {{{ methods */
|
|
2301
2750
|
/* {{{ public methods */
|
|
2302
|
-
|
|
2751
|
+
/** Reset the inner cache (mainly for dynamic mode if context has changed) */
|
|
2303
2752
|
clearCache(forceReset = false) {
|
|
2304
2753
|
this.store.clearCache(forceReset);
|
|
2305
2754
|
}
|
|
2306
|
-
|
|
2755
|
+
/** Allow to change all text of the component */
|
|
2307
2756
|
changeTexts(texts) {
|
|
2308
2757
|
this.store.changeTexts(texts);
|
|
2309
2758
|
}
|
|
2310
|
-
|
|
2759
|
+
/** Allow to change all icons of the component */
|
|
2760
|
+
changeIcons(icons, iconFamily) {
|
|
2761
|
+
this.store.changeIcons(icons, iconFamily);
|
|
2762
|
+
}
|
|
2763
|
+
/** Return the current selection */
|
|
2311
2764
|
getValue() {
|
|
2312
2765
|
const value = this.store.state.internalValue;
|
|
2313
2766
|
if (value === null && typeof this.params.emptyValue !== 'undefined') {
|
|
@@ -2315,7 +2768,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2315
2768
|
}
|
|
2316
2769
|
return value;
|
|
2317
2770
|
}
|
|
2318
|
-
|
|
2771
|
+
/** Return the current selection in Item format */
|
|
2319
2772
|
getSelectedItems() {
|
|
2320
2773
|
const values = this.store.state.internalValue;
|
|
2321
2774
|
if (values === null) {
|
|
@@ -2329,7 +2782,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2329
2782
|
}
|
|
2330
2783
|
return this.store.getItem(values);
|
|
2331
2784
|
}
|
|
2332
|
-
|
|
2785
|
+
/** Check if there are Options available in the components */
|
|
2333
2786
|
isEmpty() {
|
|
2334
2787
|
const total = this.store.state.totalAllOptions;
|
|
2335
2788
|
return total === 0;
|
|
@@ -2442,6 +2895,11 @@ let Selectic = class Selectic extends Vue {
|
|
|
2442
2895
|
this.changeTexts(texts);
|
|
2443
2896
|
}
|
|
2444
2897
|
}
|
|
2898
|
+
onIconsChange() {
|
|
2899
|
+
const icons = this.icons;
|
|
2900
|
+
const iconFamily = this.iconFamily;
|
|
2901
|
+
this.changeIcons(icons !== null && icons !== void 0 ? icons : {}, iconFamily);
|
|
2902
|
+
}
|
|
2445
2903
|
onDisabledChange() {
|
|
2446
2904
|
this.store.props.disabled = this.disabled;
|
|
2447
2905
|
}
|
|
@@ -2614,6 +3072,8 @@ let Selectic = class Selectic extends Vue {
|
|
|
2614
3072
|
selectionIsExcluded: this.selectionIsExcluded,
|
|
2615
3073
|
disabled: this.disabled,
|
|
2616
3074
|
texts: this.texts,
|
|
3075
|
+
icons: this.icons,
|
|
3076
|
+
iconFamily: this.iconFamily,
|
|
2617
3077
|
groups: deepClone(this.groups),
|
|
2618
3078
|
keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
|
|
2619
3079
|
params: {
|
|
@@ -2636,6 +3096,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2636
3096
|
listPosition: this.params.listPosition || 'auto',
|
|
2637
3097
|
optionBehavior: this.params.optionBehavior,
|
|
2638
3098
|
isOpen: ((_c = this.open) !== null && _c !== void 0 ? _c : false) !== false,
|
|
3099
|
+
disableGroupSelection: this.params.disableGroupSelection,
|
|
2639
3100
|
},
|
|
2640
3101
|
fetchCallback: this.params.fetchCallback,
|
|
2641
3102
|
getItemsCallback: this.params.getItemsCallback,
|
|
@@ -2644,6 +3105,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2644
3105
|
this._getMethods({
|
|
2645
3106
|
clearCache: this.clearCache.bind(this),
|
|
2646
3107
|
changeTexts: this.changeTexts.bind(this),
|
|
3108
|
+
changeIcons: this.changeIcons.bind(this),
|
|
2647
3109
|
getValue: this.getValue.bind(this),
|
|
2648
3110
|
getSelectedItems: this.getSelectedItems.bind(this),
|
|
2649
3111
|
isEmpty: this.isEmpty.bind(this),
|
|
@@ -2732,6 +3194,12 @@ __decorate([
|
|
|
2732
3194
|
__decorate([
|
|
2733
3195
|
Prop()
|
|
2734
3196
|
], Selectic.prototype, "texts", void 0);
|
|
3197
|
+
__decorate([
|
|
3198
|
+
Prop()
|
|
3199
|
+
], Selectic.prototype, "icons", void 0);
|
|
3200
|
+
__decorate([
|
|
3201
|
+
Prop()
|
|
3202
|
+
], Selectic.prototype, "iconFamily", void 0);
|
|
2735
3203
|
__decorate([
|
|
2736
3204
|
Prop({ default: false })
|
|
2737
3205
|
], Selectic.prototype, "noCache", void 0);
|
|
@@ -2763,6 +3231,10 @@ __decorate([
|
|
|
2763
3231
|
__decorate([
|
|
2764
3232
|
Watch('texts', { deep: true })
|
|
2765
3233
|
], Selectic.prototype, "onTextsChange", null);
|
|
3234
|
+
__decorate([
|
|
3235
|
+
Watch('iconFamily'),
|
|
3236
|
+
Watch('icons', { deep: true })
|
|
3237
|
+
], Selectic.prototype, "onIconsChange", null);
|
|
2766
3238
|
__decorate([
|
|
2767
3239
|
Watch('disabled')
|
|
2768
3240
|
], Selectic.prototype, "onDisabledChange", null);
|
|
@@ -2789,4 +3261,4 @@ Selectic = __decorate([
|
|
|
2789
3261
|
], Selectic);
|
|
2790
3262
|
var Selectic$1 = Selectic;
|
|
2791
3263
|
|
|
2792
|
-
export { changeTexts, Selectic$1 as default };
|
|
3264
|
+
export { changeIcons, changeTexts, Selectic$1 as default };
|