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.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], () => {
|
|
@@ -310,6 +326,11 @@ class SelecticStore {
|
|
|
310
326
|
}, { deep: true });
|
|
311
327
|
watch(() => this.state.internalValue, () => {
|
|
312
328
|
this.buildSelectedOptions();
|
|
329
|
+
/* If there is only one item, and the previous selected value was
|
|
330
|
+
* different, then if we change it to the only available item we
|
|
331
|
+
* should disable Selectic (user has no more choice).
|
|
332
|
+
* This is why it is needed to check autoDisabled here. */
|
|
333
|
+
this.checkAutoDisabled();
|
|
313
334
|
}, { deep: true });
|
|
314
335
|
watch(() => this.state.allOptions, () => {
|
|
315
336
|
this.checkAutoSelect();
|
|
@@ -351,6 +372,9 @@ class SelecticStore {
|
|
|
351
372
|
if (this.props.texts) {
|
|
352
373
|
this.changeTexts(this.props.texts);
|
|
353
374
|
}
|
|
375
|
+
if (this.props.icons || this.props.iconFamily) {
|
|
376
|
+
this.changeIcons(this.props.icons, this.props.iconFamily);
|
|
377
|
+
}
|
|
354
378
|
this.addGroups(this.props.groups);
|
|
355
379
|
this.assertValueType();
|
|
356
380
|
this.buildAllOptions();
|
|
@@ -468,17 +492,38 @@ class SelecticStore {
|
|
|
468
492
|
}
|
|
469
493
|
return this.buildSelectedItems(ids);
|
|
470
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
|
+
}
|
|
471
516
|
selectItem(id, selected, keepOpen = false) {
|
|
472
517
|
const state = this.state;
|
|
473
518
|
let hasChanged = false;
|
|
474
519
|
const item = state.allOptions.find((opt) => opt.id === id);
|
|
475
520
|
/* Check that item is not disabled */
|
|
476
521
|
if (item === null || item === void 0 ? void 0 : item.disabled) {
|
|
477
|
-
return;
|
|
522
|
+
return hasChanged;
|
|
478
523
|
}
|
|
479
524
|
if (state.strictValue && !this.hasValue(id)) {
|
|
480
525
|
/* reject invalid values */
|
|
481
|
-
return;
|
|
526
|
+
return hasChanged;
|
|
482
527
|
}
|
|
483
528
|
if (state.multiple) {
|
|
484
529
|
/* multiple = true */
|
|
@@ -526,12 +571,12 @@ class SelecticStore {
|
|
|
526
571
|
}
|
|
527
572
|
if (!selected) {
|
|
528
573
|
if (id !== oldValue) {
|
|
529
|
-
return;
|
|
574
|
+
return hasChanged;
|
|
530
575
|
}
|
|
531
576
|
id = null;
|
|
532
577
|
}
|
|
533
578
|
else if (id === oldValue) {
|
|
534
|
-
return;
|
|
579
|
+
return hasChanged;
|
|
535
580
|
}
|
|
536
581
|
if (keepOpen) {
|
|
537
582
|
/* if keepOpen is true it means that it is an automatic change */
|
|
@@ -543,6 +588,7 @@ class SelecticStore {
|
|
|
543
588
|
if (hasChanged) {
|
|
544
589
|
state.status.hasChanged = true;
|
|
545
590
|
}
|
|
591
|
+
return hasChanged;
|
|
546
592
|
}
|
|
547
593
|
toggleSelectAll() {
|
|
548
594
|
if (!this.state.multiple) {
|
|
@@ -612,6 +658,14 @@ class SelecticStore {
|
|
|
612
658
|
changeTexts(texts) {
|
|
613
659
|
this.data.labels = Object.assign({}, this.data.labels, texts);
|
|
614
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
|
+
}
|
|
615
669
|
/* }}} */
|
|
616
670
|
/* {{{ private methods */
|
|
617
671
|
hasValue(id) {
|
|
@@ -716,6 +770,7 @@ class SelecticStore {
|
|
|
716
770
|
if (!this.data.doNotUpdate) {
|
|
717
771
|
this.state.filteredOptions = this.buildItems(this.state.filteredOptions);
|
|
718
772
|
this.buildSelectedOptions();
|
|
773
|
+
this.updateGroupSelection();
|
|
719
774
|
}
|
|
720
775
|
}
|
|
721
776
|
addGroups(groups) {
|
|
@@ -723,7 +778,7 @@ class SelecticStore {
|
|
|
723
778
|
this.state.groups.set(group.id, group.text);
|
|
724
779
|
});
|
|
725
780
|
}
|
|
726
|
-
|
|
781
|
+
/** This method is for the computed property listOptions */
|
|
727
782
|
getListOptions() {
|
|
728
783
|
const options = deepClone(this.props.options, ['data']);
|
|
729
784
|
const listOptions = [];
|
|
@@ -874,13 +929,11 @@ class SelecticStore {
|
|
|
874
929
|
/* Do not fetch again just build filteredOptions */
|
|
875
930
|
const search = this.state.searchText;
|
|
876
931
|
if (!search) {
|
|
877
|
-
this.
|
|
878
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
932
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
879
933
|
return;
|
|
880
934
|
}
|
|
881
935
|
const options = this.filterOptions(allOptions, search);
|
|
882
|
-
this.
|
|
883
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
936
|
+
this.setFilteredOptions(options);
|
|
884
937
|
}
|
|
885
938
|
}
|
|
886
939
|
async buildFilteredOptions() {
|
|
@@ -902,13 +955,11 @@ class SelecticStore {
|
|
|
902
955
|
/* Check if all options have been fetched */
|
|
903
956
|
if (hasFetchedAllItems) {
|
|
904
957
|
if (!search) {
|
|
905
|
-
this.
|
|
906
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
958
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
907
959
|
return;
|
|
908
960
|
}
|
|
909
961
|
const options = this.filterOptions(allOptions, search);
|
|
910
|
-
this.
|
|
911
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
962
|
+
this.setFilteredOptions(options);
|
|
912
963
|
return;
|
|
913
964
|
}
|
|
914
965
|
/* When we only have partial options */
|
|
@@ -919,8 +970,7 @@ class SelecticStore {
|
|
|
919
970
|
return;
|
|
920
971
|
}
|
|
921
972
|
if (!search && endIndex <= allOptionsLength) {
|
|
922
|
-
this.
|
|
923
|
-
this.state.totalFilteredOptions = totalAllOptions + this.state.groups.size;
|
|
973
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions), false, totalAllOptions + this.state.groups.size);
|
|
924
974
|
const isPartial = unref(this.isPartial);
|
|
925
975
|
if (isPartial && this.state.totalDynOptions === Infinity) {
|
|
926
976
|
this.fetchData();
|
|
@@ -1034,7 +1084,7 @@ class SelecticStore {
|
|
|
1034
1084
|
/* Added options are the same as previous ones.
|
|
1035
1085
|
* Stop fetching to avoid infinite loop
|
|
1036
1086
|
*/
|
|
1037
|
-
if (!this.hasFetchedAllItems) {
|
|
1087
|
+
if (!unref(this.hasFetchedAllItems)) {
|
|
1038
1088
|
/* Display error if all items are not fetch
|
|
1039
1089
|
* We can have the case where old value and result
|
|
1040
1090
|
* are the same but total is correct when the
|
|
@@ -1058,6 +1108,10 @@ class SelecticStore {
|
|
|
1058
1108
|
const previousItem = state.filteredOptions[filteredOptionsLength - 1];
|
|
1059
1109
|
const options = this.buildGroupItems(result, previousItem);
|
|
1060
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
|
+
*/
|
|
1061
1115
|
state.filteredOptions.splice(offset + dynOffset, limit + nbGroups1, ...options);
|
|
1062
1116
|
}
|
|
1063
1117
|
let nbGroups = state.groups.size;
|
|
@@ -1065,6 +1119,7 @@ class SelecticStore {
|
|
|
1065
1119
|
nbGroups = this.nbGroups(state.filteredOptions);
|
|
1066
1120
|
}
|
|
1067
1121
|
state.totalFilteredOptions = total + nbGroups + dynOffset;
|
|
1122
|
+
this.updateGroupSelection();
|
|
1068
1123
|
if (search && state.totalFilteredOptions <= state.filteredOptions.length) {
|
|
1069
1124
|
this.addStaticFilteredOptions(true);
|
|
1070
1125
|
}
|
|
@@ -1113,8 +1168,7 @@ class SelecticStore {
|
|
|
1113
1168
|
options = this.filterOptions(unref(this.elementOptions), search);
|
|
1114
1169
|
break;
|
|
1115
1170
|
}
|
|
1116
|
-
this.
|
|
1117
|
-
this.state.totalFilteredOptions += options.length;
|
|
1171
|
+
this.setFilteredOptions(options, true);
|
|
1118
1172
|
}
|
|
1119
1173
|
}
|
|
1120
1174
|
buildSelectedItems(ids) {
|
|
@@ -1256,8 +1310,368 @@ class SelecticStore {
|
|
|
1256
1310
|
state.hideFilter = state.totalAllOptions <= this.data.itemsPerPage;
|
|
1257
1311
|
}
|
|
1258
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
|
+
}
|
|
1259
1357
|
}
|
|
1260
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
|
+
|
|
1261
1675
|
/* File Purpose:
|
|
1262
1676
|
* It displays the core element which is always visible (where selection is
|
|
1263
1677
|
* displayed) and handles all interaction with it.
|
|
@@ -1522,16 +1936,16 @@ let MainInput = class MainInput extends Vue {
|
|
|
1522
1936
|
'selectic-item_text',
|
|
1523
1937
|
], title: this.store.state.placeholder }, this.store.state.placeholder)),
|
|
1524
1938
|
this.store.state.multiple && (h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
|
|
1525
|
-
this.isSelectionReversed && (h("
|
|
1939
|
+
this.isSelectionReversed && (h(Icon$1, { icon: "strikethrough", store: this.store, class: "selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
|
|
1526
1940
|
this.showSelectedOptions.map((item) => (h("div", { class: "single-value", style: item.style, title: item.title || item.text, on: {
|
|
1527
1941
|
click: () => this.$emit('item:click', item.id),
|
|
1528
1942
|
} },
|
|
1529
1943
|
h("span", { class: "selectic-input__selected-items__value" }, item.text),
|
|
1530
|
-
!this.isDisabled && (h(
|
|
1944
|
+
!this.isDisabled && (h(Icon$1, { icon: "times", class: "selectic-input__selected-items__icon", store: this.store, on: {
|
|
1531
1945
|
'click.prevent.stop': () => this.selectItem(item.id),
|
|
1532
1946
|
} }))))),
|
|
1533
1947
|
this.moreSelectedNb && (h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
|
|
1534
|
-
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 } }))),
|
|
1535
1949
|
h("div", { class: [
|
|
1536
1950
|
'selectic__icon-container',
|
|
1537
1951
|
'form-control-feedback',
|
|
@@ -1539,7 +1953,7 @@ let MainInput = class MainInput extends Vue {
|
|
|
1539
1953
|
], on: {
|
|
1540
1954
|
'click.prevent.stop': () => this.toggleFocus(),
|
|
1541
1955
|
} },
|
|
1542
|
-
h(
|
|
1956
|
+
h(Icon$1, { icon: "caret-down", class: "selectic-icon", store: this.store }))));
|
|
1543
1957
|
}
|
|
1544
1958
|
};
|
|
1545
1959
|
__decorate$4([
|
|
@@ -1687,7 +2101,7 @@ let FilterPanel = class FilterPanel extends Vue {
|
|
|
1687
2101
|
h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: state.searchText, on: {
|
|
1688
2102
|
'input.stop.prevent': this.onInput,
|
|
1689
2103
|
}, ref: "filterInput" }),
|
|
1690
|
-
h("
|
|
2104
|
+
h(Icon$1, { icon: "search", store: this.store, class: "selectic-search-scope form-control-feedback" })),
|
|
1691
2105
|
state.multiple && (h("div", { class: "toggle-selectic" },
|
|
1692
2106
|
h("label", { class: ['control-label', {
|
|
1693
2107
|
'selectic__label-disabled': this.disableSelectAll,
|
|
@@ -1707,12 +2121,8 @@ let FilterPanel = class FilterPanel extends Vue {
|
|
|
1707
2121
|
!state.keepFilterOpen && (h("div", { class: "curtain-handler", on: {
|
|
1708
2122
|
'click.prevent.stop': this.togglePanel,
|
|
1709
2123
|
} },
|
|
1710
|
-
h(
|
|
1711
|
-
h(
|
|
1712
|
-
'fa': true,
|
|
1713
|
-
'fa-caret-down': this.closed,
|
|
1714
|
-
'fa-caret-up': !this.closed,
|
|
1715
|
-
} })))));
|
|
2124
|
+
h(Icon$1, { icon: "search", store: this.store }),
|
|
2125
|
+
h(Icon$1, { icon: this.closed ? 'caret-down' : 'caret-up', store: this.store })))));
|
|
1716
2126
|
}
|
|
1717
2127
|
};
|
|
1718
2128
|
__decorate$3([
|
|
@@ -1772,7 +2182,7 @@ let List = class List extends Vue {
|
|
|
1772
2182
|
text: '',
|
|
1773
2183
|
disabled: true,
|
|
1774
2184
|
selected: false,
|
|
1775
|
-
icon: '
|
|
2185
|
+
icon: 'current:spinner:spin',
|
|
1776
2186
|
isGroup: false,
|
|
1777
2187
|
});
|
|
1778
2188
|
}
|
|
@@ -1822,7 +2232,11 @@ let List = class List extends Vue {
|
|
|
1822
2232
|
/* }}} */
|
|
1823
2233
|
/* {{{ methods */
|
|
1824
2234
|
click(option) {
|
|
1825
|
-
if (option.disabled
|
|
2235
|
+
if (option.disabled) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
if (option.isGroup) {
|
|
2239
|
+
this.store.selectGroup(option.id, !option.selected);
|
|
1826
2240
|
return;
|
|
1827
2241
|
}
|
|
1828
2242
|
this.store.selectItem(option.id);
|
|
@@ -1910,14 +2324,17 @@ let List = class List extends Vue {
|
|
|
1910
2324
|
'mouseover': () => this.onMouseOver(idx),
|
|
1911
2325
|
}, class: ['selectic-item', option.className || '', {
|
|
1912
2326
|
'selected': option.selected,
|
|
2327
|
+
'selectable': unref(this.store.allowGroupSelection) && option.isGroup && !option.disabled,
|
|
1913
2328
|
'selectic-item__active': idx + this.startIndex === this.store.state.activeItemIdx,
|
|
1914
2329
|
'selectic-item__disabled': !!option.disabled,
|
|
1915
2330
|
'selectic-item__exclusive': !!option.exclusive,
|
|
1916
2331
|
'selectic-item__is-in-group': !!option.group,
|
|
1917
2332
|
'selectic-item__is-group': option.isGroup,
|
|
1918
2333
|
}], style: option.style, title: option.title, key: 'selectic-item-' + (idx + this.startIndex) },
|
|
1919
|
-
this.isMultiple && (h(
|
|
1920
|
-
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 })),
|
|
1921
2338
|
option.text))),
|
|
1922
2339
|
!!this.bottomOffset && (h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` })))));
|
|
1923
2340
|
}
|
|
@@ -1962,7 +2379,8 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
1962
2379
|
super(...arguments);
|
|
1963
2380
|
/* }}} */
|
|
1964
2381
|
/* {{{ data */
|
|
1965
|
-
this.
|
|
2382
|
+
this.topGroupName = ' ';
|
|
2383
|
+
this.topGroupId = null;
|
|
1966
2384
|
this.listHeight = 0;
|
|
1967
2385
|
this.listWidth = 200;
|
|
1968
2386
|
this.availableSpace = 0;
|
|
@@ -2106,6 +2524,24 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2106
2524
|
--availableSpace: ${availableSpace}px;
|
|
2107
2525
|
`;
|
|
2108
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
|
+
}
|
|
2109
2545
|
/* }}} */
|
|
2110
2546
|
/* {{{ watch */
|
|
2111
2547
|
onFilteredOptionsChange() {
|
|
@@ -2119,13 +2555,17 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2119
2555
|
getGroup(id) {
|
|
2120
2556
|
const group = this.store.state.groups.get(id);
|
|
2121
2557
|
const groupName = group || ' ';
|
|
2122
|
-
this.
|
|
2558
|
+
this.topGroupName = groupName;
|
|
2559
|
+
this.topGroupId = id;
|
|
2123
2560
|
}
|
|
2124
2561
|
computeListSize() {
|
|
2125
2562
|
const box = this.$el.getBoundingClientRect();
|
|
2126
2563
|
this.listHeight = box.height;
|
|
2127
2564
|
this.listWidth = box.width;
|
|
2128
2565
|
}
|
|
2566
|
+
clickHeaderGroup() {
|
|
2567
|
+
this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
|
|
2568
|
+
}
|
|
2129
2569
|
/* }}} */
|
|
2130
2570
|
/* {{{ Life cycles */
|
|
2131
2571
|
mounted() {
|
|
@@ -2151,13 +2591,24 @@ let ExtendedList = class ExtendedList extends Vue {
|
|
|
2151
2591
|
`selectic-position-${this.position}`,
|
|
2152
2592
|
] },
|
|
2153
2593
|
!state.hideFilter && (h(Filter, { store: this.store })),
|
|
2154
|
-
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)),
|
|
2155
2606
|
h(List$1, { store: store, on: {
|
|
2156
2607
|
groupId: this.getGroup,
|
|
2157
2608
|
} }),
|
|
2158
2609
|
this.infoMessage && (h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
|
|
2159
2610
|
this.searching && (h("div", { class: "selectic__message" },
|
|
2160
|
-
h(
|
|
2611
|
+
h(Icon$1, { icon: "spinner", store: this.store, spin: true }),
|
|
2161
2612
|
this.searchingLabel)),
|
|
2162
2613
|
this.errorMessage && (h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
|
|
2163
2614
|
}
|
|
@@ -2206,6 +2657,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
2206
2657
|
function changeTexts(texts) {
|
|
2207
2658
|
changeTexts$1(texts);
|
|
2208
2659
|
}
|
|
2660
|
+
function changeIcons(icons, iconFamily) {
|
|
2661
|
+
changeIcons$1(icons, iconFamily);
|
|
2662
|
+
}
|
|
2209
2663
|
let Selectic = class Selectic extends Vue {
|
|
2210
2664
|
constructor() {
|
|
2211
2665
|
super(...arguments);
|
|
@@ -2294,15 +2748,19 @@ let Selectic = class Selectic extends Vue {
|
|
|
2294
2748
|
/* }}} */
|
|
2295
2749
|
/* {{{ methods */
|
|
2296
2750
|
/* {{{ public methods */
|
|
2297
|
-
|
|
2751
|
+
/** Reset the inner cache (mainly for dynamic mode if context has changed) */
|
|
2298
2752
|
clearCache(forceReset = false) {
|
|
2299
2753
|
this.store.clearCache(forceReset);
|
|
2300
2754
|
}
|
|
2301
|
-
|
|
2755
|
+
/** Allow to change all text of the component */
|
|
2302
2756
|
changeTexts(texts) {
|
|
2303
2757
|
this.store.changeTexts(texts);
|
|
2304
2758
|
}
|
|
2305
|
-
|
|
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 */
|
|
2306
2764
|
getValue() {
|
|
2307
2765
|
const value = this.store.state.internalValue;
|
|
2308
2766
|
if (value === null && typeof this.params.emptyValue !== 'undefined') {
|
|
@@ -2310,7 +2768,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2310
2768
|
}
|
|
2311
2769
|
return value;
|
|
2312
2770
|
}
|
|
2313
|
-
|
|
2771
|
+
/** Return the current selection in Item format */
|
|
2314
2772
|
getSelectedItems() {
|
|
2315
2773
|
const values = this.store.state.internalValue;
|
|
2316
2774
|
if (values === null) {
|
|
@@ -2324,7 +2782,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2324
2782
|
}
|
|
2325
2783
|
return this.store.getItem(values);
|
|
2326
2784
|
}
|
|
2327
|
-
|
|
2785
|
+
/** Check if there are Options available in the components */
|
|
2328
2786
|
isEmpty() {
|
|
2329
2787
|
const total = this.store.state.totalAllOptions;
|
|
2330
2788
|
return total === 0;
|
|
@@ -2437,6 +2895,11 @@ let Selectic = class Selectic extends Vue {
|
|
|
2437
2895
|
this.changeTexts(texts);
|
|
2438
2896
|
}
|
|
2439
2897
|
}
|
|
2898
|
+
onIconsChange() {
|
|
2899
|
+
const icons = this.icons;
|
|
2900
|
+
const iconFamily = this.iconFamily;
|
|
2901
|
+
this.changeIcons(icons !== null && icons !== void 0 ? icons : {}, iconFamily);
|
|
2902
|
+
}
|
|
2440
2903
|
onDisabledChange() {
|
|
2441
2904
|
this.store.props.disabled = this.disabled;
|
|
2442
2905
|
}
|
|
@@ -2609,6 +3072,8 @@ let Selectic = class Selectic extends Vue {
|
|
|
2609
3072
|
selectionIsExcluded: this.selectionIsExcluded,
|
|
2610
3073
|
disabled: this.disabled,
|
|
2611
3074
|
texts: this.texts,
|
|
3075
|
+
icons: this.icons,
|
|
3076
|
+
iconFamily: this.iconFamily,
|
|
2612
3077
|
groups: deepClone(this.groups),
|
|
2613
3078
|
keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
|
|
2614
3079
|
params: {
|
|
@@ -2631,6 +3096,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2631
3096
|
listPosition: this.params.listPosition || 'auto',
|
|
2632
3097
|
optionBehavior: this.params.optionBehavior,
|
|
2633
3098
|
isOpen: ((_c = this.open) !== null && _c !== void 0 ? _c : false) !== false,
|
|
3099
|
+
disableGroupSelection: this.params.disableGroupSelection,
|
|
2634
3100
|
},
|
|
2635
3101
|
fetchCallback: this.params.fetchCallback,
|
|
2636
3102
|
getItemsCallback: this.params.getItemsCallback,
|
|
@@ -2639,6 +3105,7 @@ let Selectic = class Selectic extends Vue {
|
|
|
2639
3105
|
this._getMethods({
|
|
2640
3106
|
clearCache: this.clearCache.bind(this),
|
|
2641
3107
|
changeTexts: this.changeTexts.bind(this),
|
|
3108
|
+
changeIcons: this.changeIcons.bind(this),
|
|
2642
3109
|
getValue: this.getValue.bind(this),
|
|
2643
3110
|
getSelectedItems: this.getSelectedItems.bind(this),
|
|
2644
3111
|
isEmpty: this.isEmpty.bind(this),
|
|
@@ -2727,6 +3194,12 @@ __decorate([
|
|
|
2727
3194
|
__decorate([
|
|
2728
3195
|
Prop()
|
|
2729
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);
|
|
2730
3203
|
__decorate([
|
|
2731
3204
|
Prop({ default: false })
|
|
2732
3205
|
], Selectic.prototype, "noCache", void 0);
|
|
@@ -2758,6 +3231,10 @@ __decorate([
|
|
|
2758
3231
|
__decorate([
|
|
2759
3232
|
Watch('texts', { deep: true })
|
|
2760
3233
|
], Selectic.prototype, "onTextsChange", null);
|
|
3234
|
+
__decorate([
|
|
3235
|
+
Watch('iconFamily'),
|
|
3236
|
+
Watch('icons', { deep: true })
|
|
3237
|
+
], Selectic.prototype, "onIconsChange", null);
|
|
2761
3238
|
__decorate([
|
|
2762
3239
|
Watch('disabled')
|
|
2763
3240
|
], Selectic.prototype, "onDisabledChange", null);
|
|
@@ -2784,4 +3261,4 @@ Selectic = __decorate([
|
|
|
2784
3261
|
], Selectic);
|
|
2785
3262
|
var Selectic$1 = Selectic;
|
|
2786
3263
|
|
|
2787
|
-
export { changeTexts, Selectic$1 as default };
|
|
3264
|
+
export { changeIcons, changeTexts, Selectic$1 as default };
|