@webitel/ui-sdk 0.1.11 → 0.1.112
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/README.md +29 -29
- package/dist/img/plyr.svg +70 -0
- package/dist/img/svg-sprites/attach.svg +4 -0
- package/dist/img/svg-sprites/index.js +1 -0
- package/dist/img/svg-sprites/wt-icon.svg +880 -0
- package/dist/ui-sdk.common.js +8287 -4335
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +8287 -4335
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +3 -1
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +62 -41
- package/src/components/atoms/wt-badge/__tests__/WtBadge.spec.js +19 -0
- package/src/components/atoms/wt-badge/wt-badge.vue +23 -0
- package/src/components/atoms/wt-button/__tests__/WtButton.spec.js +29 -0
- package/src/components/atoms/wt-button/wt-button.vue +212 -0
- package/src/components/atoms/wt-divider/__tests__/WtDivider.spec.js +9 -0
- package/src/components/atoms/wt-divider/wt-divider.vue +25 -0
- package/src/components/atoms/wt-icon/__tests__/WtIcon.spec.js +24 -0
- package/src/components/atoms/wt-icon/wt-icon.vue +138 -0
- package/src/components/atoms/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
- package/src/components/atoms/wt-indicator/wt-indicator.vue +81 -0
- package/src/components/atoms/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
- package/src/components/atoms/wt-input-info/wt-input-info.vue +35 -0
- package/src/components/atoms/wt-loader/__tests__/WtLoader.spec.js +9 -0
- package/src/components/atoms/wt-loader/_internals/wt-loader--md.vue +83 -0
- package/src/components/atoms/wt-loader/_internals/wt-loader--sm.vue +189 -0
- package/src/components/atoms/wt-loader/wt-loader.vue +34 -0
- package/src/components/atoms/wt-rounded-action/__tests__/WtRoundedAction.spec.js +20 -0
- package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +227 -0
- package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +29 -0
- package/src/components/atoms/wt-tooltip/wt-tooltip.vue +54 -0
- package/src/components/index.js +98 -0
- package/src/components/molecules/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
- package/src/components/molecules/wt-checkbox/wt-checkbox.vue +175 -0
- package/src/components/molecules/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +209 -0
- package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +67 -0
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +314 -0
- package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +31 -0
- package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +113 -0
- package/src/components/molecules/wt-input/__tests__/WtInput.spec.js +25 -0
- package/src/components/molecules/wt-input/wt-input.vue +316 -0
- package/src/components/molecules/wt-label/__tests__/WtLabel.spec.js +9 -0
- package/src/components/molecules/wt-label/wt-label.vue +87 -0
- package/src/components/molecules/wt-notification/__tests__/WtNotification.spec.js +21 -0
- package/src/components/molecules/wt-notification/wt-notification.vue +74 -0
- package/src/components/molecules/wt-popup/__tests__/WtPopup.spec.js +47 -0
- package/src/components/molecules/wt-popup/wt-popup.vue +130 -0
- package/src/components/molecules/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
- package/src/components/molecules/wt-progress-bar/wt-progress-bar.vue +80 -0
- package/src/components/molecules/wt-radio/__tests__/WtRadio.spec.js +42 -0
- package/src/components/molecules/wt-radio/wt-radio.vue +168 -0
- package/src/components/molecules/wt-search-bar/__tests__/WtSearchBar.spec.js +36 -0
- package/src/components/molecules/wt-search-bar/wt-search-bar.vue +203 -0
- package/src/components/molecules/wt-select/__tests__/WtSelect.spec.js +53 -0
- package/src/components/molecules/wt-select/wt-select.vue +492 -0
- package/src/components/molecules/wt-slider/__tests__/WtSlider.spec.js +9 -0
- package/src/components/molecules/wt-slider/wt-slider.vue +175 -0
- package/src/components/molecules/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
- package/src/components/molecules/wt-switcher/wt-switcher.vue +177 -0
- package/src/components/molecules/wt-tabs/__tests__/WtTabs.spec.js +36 -0
- package/src/components/molecules/wt-tabs/wt-tabs.vue +127 -0
- package/src/components/molecules/wt-tags-input/__tests__/WtTagsInput.spec.js +45 -0
- package/src/components/molecules/wt-tags-input/wt-tags-input.vue +295 -0
- package/src/components/molecules/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
- package/src/components/molecules/wt-textarea/wt-textarea.vue +185 -0
- package/src/components/molecules/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
- package/src/components/molecules/wt-time-input/wt-time-input.vue +192 -0
- package/src/components/molecules/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
- package/src/components/molecules/wt-timepicker/wt-timepicker.vue +176 -0
- package/src/components/organisms/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
- package/src/components/organisms/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
- package/src/components/organisms/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
- package/src/components/organisms/wt-app-header/wt-app-header.vue +23 -0
- package/src/components/organisms/wt-app-header/wt-app-navigator.vue +245 -0
- package/src/components/organisms/wt-app-header/wt-header-actions.vue +177 -0
- package/src/components/organisms/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
- package/src/components/organisms/wt-error-page/wt-error-page.vue +104 -0
- package/src/components/organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js +24 -0
- package/src/components/organisms/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
- package/src/components/organisms/wt-headline/__tests__/WtHeadline.spec.js +47 -0
- package/src/components/organisms/wt-headline/wt-headline.vue +46 -0
- package/src/components/organisms/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +64 -0
- package/src/components/organisms/wt-navigation-bar/wt-navigation-bar.vue +249 -0
- package/src/components/organisms/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
- package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +71 -0
- package/src/components/organisms/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
- package/src/components/organisms/wt-page-wrapper/wt-page-wrapper.vue +60 -0
- package/src/components/organisms/wt-pagination/__tests__/WtPagination.spec.js +38 -0
- package/src/components/organisms/wt-pagination/wt-pagination.vue +134 -0
- package/src/components/organisms/wt-player/__tests__/WtPlayer.spec.js +9 -0
- package/src/components/organisms/wt-player/wt-player.vue +116 -0
- package/src/components/organisms/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
- package/src/components/organisms/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
- package/src/components/organisms/wt-status-select/wt-status-select.vue +110 -0
- package/src/components/organisms/wt-table/__tests__/WtTable.spec.js +133 -0
- package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +9 -0
- package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +9 -0
- package/src/components/organisms/wt-table/_internals/getSortOrder.js +12 -0
- package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +18 -0
- package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +19 -0
- package/src/components/organisms/wt-table/wt-table.vue +241 -0
- package/src/components/organisms/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
- package/src/components/organisms/wt-table-actions/wt-table-actions.vue +90 -0
- package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
- package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +113 -0
- package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
- package/src/components/transitions/expand-transition.vue +70 -0
- package/src/css/colors/_colors.scss +151 -67
- package/src/css/components/_components.scss +38 -25
- package/src/css/components/atoms/wt-badge/_variables.scss +6 -5
- package/src/css/components/atoms/wt-badge/wt-badge.scss +36 -8
- package/src/css/components/atoms/wt-button/_variables.scss +46 -46
- package/src/css/components/atoms/wt-divider/_variables.scss +4 -4
- package/src/css/components/atoms/wt-icon/_variables.scss +7 -28
- package/src/css/components/atoms/wt-indicator/_variables.scss +18 -0
- package/src/css/components/atoms/wt-input-info/_variables.scss +6 -5
- package/src/css/components/atoms/wt-label/_variables.scss +4 -4
- package/src/css/components/atoms/wt-loader/_variables.scss +7 -7
- package/src/css/components/atoms/wt-rounded-action/_variables.scss +30 -0
- package/src/css/components/atoms/wt-tooltip/_variables.scss +9 -9
- package/src/css/components/molecules/wt-checkbox/_variables.scss +3 -3
- package/src/css/components/molecules/wt-datepicker/_variables.scss +19 -19
- package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +100 -100
- package/src/css/components/molecules/wt-datetimepicker/_variables.scss +11 -11
- package/src/css/components/molecules/wt-icon-btn/_variables.scss +2 -2
- package/src/css/components/molecules/wt-input/_variables.scss +5 -5
- package/src/css/components/molecules/wt-notification/_variables.scss +9 -9
- package/src/css/components/molecules/wt-popup/_variables.scss +11 -10
- package/src/css/components/molecules/wt-progress-bar/_variables.scss +11 -0
- package/src/css/components/molecules/wt-radio/_variables.scss +6 -6
- package/src/css/components/molecules/wt-search-bar/_variables.scss +3 -3
- package/src/css/components/molecules/wt-select/_variables.scss +24 -22
- package/src/css/components/molecules/wt-slider/_variables.scss +15 -0
- package/src/css/components/molecules/wt-switcher/_variables.scss +17 -14
- package/src/css/components/molecules/wt-tabs/_variables.scss +13 -13
- package/src/css/components/molecules/wt-tags-input/_variables.scss +25 -0
- package/src/css/components/molecules/wt-textarea/_variables.scss +4 -4
- package/src/css/components/molecules/wt-timepicker/_variables.scss +4 -3
- package/src/css/components/organisms/wt-app-header/_variables.scss +20 -0
- package/src/css/components/organisms/wt-headline/_variables.scss +7 -0
- package/src/css/components/organisms/wt-navigation-bar/_variables.scss +14 -0
- package/src/css/components/organisms/wt-notifications-bar/_variables.scss +7 -0
- package/src/css/components/organisms/wt-page-wrapper/_variables.scss +5 -0
- package/src/css/components/organisms/wt-pagination/_variables.scss +6 -6
- package/src/css/components/organisms/wt-status-select/_variables.scss +6 -0
- package/src/css/components/organisms/wt-table/_variables.scss +16 -0
- package/src/css/components/organisms/wt-table-actions/_variables.scss +4 -0
- package/src/css/display-helpers/_display-helpers.scss +21 -0
- package/src/css/fonts/_fonts.scss +9 -0
- package/src/css/main.scss +68 -65
- package/src/css/shadows/_shadows.scss +7 -0
- package/src/css/sizes/_sizes.scss +2 -0
- package/src/css/sizes/_spacing.scss +17 -0
- package/src/css/sizes/_viewport-breakpoints.scss +20 -0
- package/src/css/styleguide/{styleguide.scss → _styleguide.scss} +4 -3
- package/src/css/styleguide/scroll.scss +43 -40
- package/src/css/transitions/_transitions.scss +1 -0
- package/src/css/transitions/fade/_fade.scss +8 -0
- package/src/css/typography/_typography.scss +72 -72
- package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
- package/src/enums/WebitelApplications/AdminSections.enum.js +41 -0
- package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +10 -0
- package/src/locale/en/en.js +135 -0
- package/src/locale/i18n.js +2 -0
- package/src/locale/ru/ru.js +135 -2
- package/src/locale/ua/ua.js +160 -0
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +57 -0
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +66 -0
- package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +93 -0
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +60 -0
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
- package/src/mixins/validationMixin/validationMixin.js +40 -0
- package/src/modules/CSVExport/CSVExport.js +88 -0
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
- package/src/modules/FilesExport/FilesExport.js +110 -0
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
- package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
- package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
- package/src/modules/QueryFilters/api/defaults.js +16 -0
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
- package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
- package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +54 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +40 -0
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +49 -0
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
- package/src/modules/QueryFilters/components/filter-search.vue +33 -0
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +54 -0
- package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +74 -0
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +58 -0
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +36 -0
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +36 -0
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +66 -0
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +50 -0
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +83 -0
- package/src/modules/QueryFilters/store/queryFilters.js +6 -0
- package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
- package/src/modules/Userinfo/api/auth.js +29 -0
- package/src/modules/Userinfo/api/userinfo.js +32 -0
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +170 -0
- package/src/modules/Userinfo/components/__tests__/auth.spec.js +57 -0
- package/src/modules/Userinfo/components/the-auth.vue +75 -0
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +112 -0
- package/src/scripts/__tests__/caseConverters.spec.js +65 -0
- package/src/scripts/__tests__/convertDuration.spec.js +21 -0
- package/src/scripts/__tests__/debounce.spec.js +15 -0
- package/src/scripts/__tests__/editProxy.spec.js +9 -0
- package/src/scripts/__tests__/isEmpty.spec.js +16 -0
- package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
- package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
- package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
- package/src/scripts/caseConverters.js +78 -0
- package/src/scripts/convertDuration.js +15 -0
- package/src/scripts/editProxy.js +9 -0
- package/src/scripts/eventBus.js +4 -0
- package/src/scripts/isEmpty.js +9 -0
- package/src/scripts/prettifyFileSize.js +11 -0
- package/src/scripts/prettifyTime.js +9 -0
- package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
- package/src/scripts/sortQueryAdapters.js +21 -0
- package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
- package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
- package/src/store/helpers/getNamespacedState.js +5 -0
- package/dist/img/arrow-down--active--md.7b60f2fb6090366652124f77c543a516.svg +0 -3
- package/dist/img/arrow-down--disabled--md.f58424cd673258365e78863edd1e92cc.svg +0 -3
- package/dist/img/arrow-down--md.1843b60e1c244e066a650e8d19ea83c9.svg +0 -3
- package/dist/img/calendar--active--md.7fd3d949ec7234a4940ea452d95b4165.svg +0 -6
- package/dist/img/calendar--disabled--md.8e7a1e18f93ae8af270060400e6f881c.svg +0 -3
- package/dist/img/calendar--md.9c265581c3a405ff0f0e46e8092f36b8.svg +0 -6
- package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/css/fonts.scss +0 -9
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="wt-select"
|
|
4
|
+
:class="{
|
|
5
|
+
'wt-select--disabled': disabled,
|
|
6
|
+
'wt-select--invalid': invalid,
|
|
7
|
+
'wt-select--clearable': clearable,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<wt-label
|
|
11
|
+
class="wt-select__label"
|
|
12
|
+
v-if="hasLabel"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:invalid="invalid"
|
|
15
|
+
v-bind="labelProps"
|
|
16
|
+
>
|
|
17
|
+
<!-- @slot Custom input label -->
|
|
18
|
+
<slot name="label" v-bind="{ label }">{{ requiredLabel }}</slot>
|
|
19
|
+
</wt-label>
|
|
20
|
+
<vue-multiselect
|
|
21
|
+
class="wt-select__select"
|
|
22
|
+
:value="selectValue"
|
|
23
|
+
:options="selectOptions"
|
|
24
|
+
:placeholder="placeholder || label"
|
|
25
|
+
:multiple="multiple"
|
|
26
|
+
:close-on-select="closeOnSelect"
|
|
27
|
+
:limit="1"
|
|
28
|
+
:label="optionLabel"
|
|
29
|
+
:track-by="trackBy"
|
|
30
|
+
:limitText="limitText"
|
|
31
|
+
:loading="false"
|
|
32
|
+
:internal-search="internalSearch"
|
|
33
|
+
:disabled="disabled"
|
|
34
|
+
:allow-empty="allowEmpty"
|
|
35
|
+
:searchable="searchable"
|
|
36
|
+
@input="input"
|
|
37
|
+
@search-change="fetch"
|
|
38
|
+
@close="close"
|
|
39
|
+
>
|
|
40
|
+
<template slot="caret">
|
|
41
|
+
<wt-icon
|
|
42
|
+
class="wt-select__arrow-caret"
|
|
43
|
+
icon="arrow-down"
|
|
44
|
+
:disabled="disabled"
|
|
45
|
+
></wt-icon>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<template slot="tag" slot-scope="{ option }">
|
|
49
|
+
<span class="multiselect__custom-tag">{{ option[optionLabel] || option }}</span>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<template slot="singleLabel" slot-scope="{ option }">
|
|
53
|
+
<slot name="singleLabel" v-bind="{ option, optionLabel }">
|
|
54
|
+
<span class="multiselect__single-label">
|
|
55
|
+
{{ option[optionLabel] || option }}
|
|
56
|
+
</span>
|
|
57
|
+
</slot>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<template slot="option" slot-scope="{ option }">
|
|
61
|
+
<slot name="option" v-bind="{ option, optionLabel }">
|
|
62
|
+
<span>
|
|
63
|
+
{{ option[optionLabel] || option }}
|
|
64
|
+
</span>
|
|
65
|
+
</slot>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<template slot="clear" slot-scope="{}">
|
|
69
|
+
<wt-icon-btn
|
|
70
|
+
v-if="clearable"
|
|
71
|
+
class="wt-select__clear"
|
|
72
|
+
:class="{ 'hidden': !isValue }"
|
|
73
|
+
:disabled="disabled"
|
|
74
|
+
icon="remove-rounded"
|
|
75
|
+
size="sm"
|
|
76
|
+
@click="clearValue"
|
|
77
|
+
></wt-icon-btn>
|
|
78
|
+
</template>
|
|
79
|
+
</vue-multiselect>
|
|
80
|
+
<wt-input-info
|
|
81
|
+
v-if="isValidation"
|
|
82
|
+
:invalid="invalid"
|
|
83
|
+
>{{ validationText }}
|
|
84
|
+
</wt-input-info>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
import VueMultiselect from 'vue-multiselect';
|
|
90
|
+
import debounce from '../../../scripts/debounce';
|
|
91
|
+
import validationMixin from '../../../mixins/validationMixin/validationMixin';
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
name: 'wt-select',
|
|
95
|
+
components: {
|
|
96
|
+
VueMultiselect,
|
|
97
|
+
},
|
|
98
|
+
mixins: [validationMixin],
|
|
99
|
+
props: {
|
|
100
|
+
value: {},
|
|
101
|
+
|
|
102
|
+
options: {
|
|
103
|
+
type: Array,
|
|
104
|
+
default: () => [],
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
label: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: '',
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
placeholder: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: '',
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
trackBy: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: 'id',
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
multiple: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
closeOnSelect: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
optionLabel: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'name',
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
internalSearch: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: true,
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
search: {
|
|
143
|
+
type: Function,
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
disabled: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false,
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
searchable: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: true,
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
clearable: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: true,
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
required: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false,
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
allowEmpty: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: true,
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
labelProps: {
|
|
172
|
+
type: Object,
|
|
173
|
+
description: 'Object with props, passed down to wt-label as props',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
data: () => ({
|
|
178
|
+
isLoading: false,
|
|
179
|
+
fetchedOptions: [],
|
|
180
|
+
}),
|
|
181
|
+
|
|
182
|
+
created() {
|
|
183
|
+
this.fetch();
|
|
184
|
+
this.fetch = debounce(this.fetch);
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
computed: {
|
|
188
|
+
selectValue() {
|
|
189
|
+
// vue-multiselect doesn't show placeholder if value is empty object
|
|
190
|
+
return this.isValue ? this.value : '';
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
hasLabel() {
|
|
194
|
+
return !!(this.label || this.$slots.label);
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
requiredLabel() {
|
|
198
|
+
return this.required ? `${this.label}*` : this.label;
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
selectOptions() {
|
|
202
|
+
if (!this.internalSearch) {
|
|
203
|
+
return this.fetchedOptions;
|
|
204
|
+
}
|
|
205
|
+
return this.options;
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
isValue() {
|
|
209
|
+
if (Array.isArray(this.value)) return !!this.value.length;
|
|
210
|
+
if (typeof this.value === 'object') return !!Object.keys(this.value).length;
|
|
211
|
+
return !!this.value;
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
methods: {
|
|
216
|
+
limitText: (count) => `${count}`,
|
|
217
|
+
|
|
218
|
+
async fetch(search) {
|
|
219
|
+
if (!this.internalSearch) {
|
|
220
|
+
this.fetchedOptions = await this.search(search);
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
clearValue() {
|
|
225
|
+
let value = '';
|
|
226
|
+
if (Array.isArray(this.value)) value = [];
|
|
227
|
+
else if (typeof this.value === 'object' && this.value !== null) value = {};
|
|
228
|
+
this.input(value);
|
|
229
|
+
this.$emit('reset', value);
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
input(value) {
|
|
233
|
+
if (value === null) return; // ATTENTION prevents crush at selected option click
|
|
234
|
+
/*
|
|
235
|
+
if "input" with current value is emitted, value is re-set
|
|
236
|
+
and it may cause unneeded patch or smth like this
|
|
237
|
+
so i tried to just cancel "input", if the same value is selected
|
|
238
|
+
("null" is emitted from VueMultiselect because default lib behavior fot this action is "reset")
|
|
239
|
+
*/
|
|
240
|
+
// if (value === null) {
|
|
241
|
+
// this.$emit('input', this.value); // ATTENTION prevents crush at selected option click
|
|
242
|
+
// return;
|
|
243
|
+
// }
|
|
244
|
+
this.$emit('input', value);
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
close() {
|
|
248
|
+
this.$emit('closed');
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
</script>
|
|
253
|
+
|
|
254
|
+
<style lang="scss" scoped>
|
|
255
|
+
@import '~vue-multiselect/dist/vue-multiselect.min.css';
|
|
256
|
+
@import '../../../css/components/atoms/wt-badge/wt-badge';
|
|
257
|
+
|
|
258
|
+
.wt-select {
|
|
259
|
+
width: 100%;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.wt-label {
|
|
264
|
+
margin-bottom: var(--label-margin);
|
|
265
|
+
cursor: text;
|
|
266
|
+
|
|
267
|
+
.wt-select:hover &,
|
|
268
|
+
.wt-select:focus-within & {
|
|
269
|
+
color: var(--form-label--hover-color);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.multiselect {
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
|
|
276
|
+
.wt-select__arrow-caret {
|
|
277
|
+
position: absolute;
|
|
278
|
+
top: var(--select-caret-top-pos);
|
|
279
|
+
right: var(--select-caret-right-pos);
|
|
280
|
+
transform: rotate(0);
|
|
281
|
+
transition: var(--transition);
|
|
282
|
+
z-index: var(--select-caret-z-index);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
::v-deep .wt-select__clear {
|
|
286
|
+
position: absolute;
|
|
287
|
+
top: var(--select-clear-top-pos);
|
|
288
|
+
right: var(--select-clear-right-pos);
|
|
289
|
+
transform: rotate(0);
|
|
290
|
+
transition: var(--transition);
|
|
291
|
+
z-index: var(--select-clear-z-index);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
::v-deep {
|
|
295
|
+
.multiselect__tags {
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
min-height: var(--select-tags-min-height); // reset original 20px style
|
|
299
|
+
box-sizing: border-box;
|
|
300
|
+
padding: var(--select-tags-padding);
|
|
301
|
+
color: var(--form-input-color);
|
|
302
|
+
border: var(--select-tags-border);
|
|
303
|
+
border-color: var(--form-border-color);
|
|
304
|
+
border-radius: var(--border-radius);
|
|
305
|
+
|
|
306
|
+
.multiselect__input,
|
|
307
|
+
.multiselect__single {
|
|
308
|
+
@extend %typo-body-lg;
|
|
309
|
+
min-height: var(--select-input-min-height); // reset original 20px style
|
|
310
|
+
padding: 0;
|
|
311
|
+
margin: 0;
|
|
312
|
+
background: transparent;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.multiselect__strong {
|
|
316
|
+
@extend %typo-body-lg;
|
|
317
|
+
@extend .wt-badge;
|
|
318
|
+
position: absolute;
|
|
319
|
+
right: var(--select-badge-right-pos);
|
|
320
|
+
min-height: var(--select-input-min-height); // reset original 20px style
|
|
321
|
+
margin: 0;
|
|
322
|
+
font-weight: normal;
|
|
323
|
+
z-index: var(--select-badge-z-index);
|
|
324
|
+
|
|
325
|
+
&:before {
|
|
326
|
+
content: '+';
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.multiselect__tags-wrap {
|
|
331
|
+
width: 100%;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.multiselect__custom-tag, .multiselect__single-label {
|
|
335
|
+
@extend %typo-body-lg;
|
|
336
|
+
color: var(--form-input-color);
|
|
337
|
+
|
|
338
|
+
// text overflow 3 dots
|
|
339
|
+
display: block;
|
|
340
|
+
white-space: nowrap;
|
|
341
|
+
overflow: hidden;
|
|
342
|
+
text-overflow: ellipsis;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.multiselect__placeholder {
|
|
346
|
+
padding: 0;
|
|
347
|
+
margin: 0;
|
|
348
|
+
color: var(--form-placeholder-color);
|
|
349
|
+
|
|
350
|
+
// text overflow 3 dots
|
|
351
|
+
white-space: nowrap;
|
|
352
|
+
overflow: hidden;
|
|
353
|
+
text-overflow: ellipsis;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.multiselect__content-wrapper {
|
|
358
|
+
@extend %wt-distant-scrollbar;
|
|
359
|
+
border: var(--select-tags-border);
|
|
360
|
+
border-color: var(--form-border-color);
|
|
361
|
+
border-radius: var(--border-radius);
|
|
362
|
+
transition: var(--transition);
|
|
363
|
+
|
|
364
|
+
.multiselect__option {
|
|
365
|
+
@extend %typo-body-lg;
|
|
366
|
+
padding: var(--select-options-padding);
|
|
367
|
+
|
|
368
|
+
& > span {
|
|
369
|
+
color: var(--form-placeholder-color);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
&:after {
|
|
373
|
+
display: none;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
&--highlight {
|
|
377
|
+
background: var(--select-option--hover-color);
|
|
378
|
+
|
|
379
|
+
& > span {
|
|
380
|
+
color: var(--form-input-color);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&--selected {
|
|
385
|
+
font-weight: normal;
|
|
386
|
+
background: var(--select-option--active-color)
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.wt-select:hover & {
|
|
393
|
+
.wt-select__arrow-caret ::v-deep .wt-icon__icon {
|
|
394
|
+
fill: var(--icon-color--hover);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
::v-deep .wt-select__clear .wt-icon__icon {
|
|
398
|
+
fill: var(--icon-color--hover);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
::v-deep {
|
|
402
|
+
.multiselect__tags {
|
|
403
|
+
border-color: var(--form-border--hover-color);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.multiselect__placeholder {
|
|
407
|
+
color: var(--form-placeholder--hover-color);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
&--active {
|
|
413
|
+
.wt-select__arrow-caret {
|
|
414
|
+
transform: rotate(180deg);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.wt-select__arrow-caret ::v-deep .wt-icon__icon {
|
|
418
|
+
fill: var(--icon-color--hover);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
::v-deep {
|
|
422
|
+
.multiselect__tags {
|
|
423
|
+
border-color: var(--form-border--active-color);
|
|
424
|
+
|
|
425
|
+
.multiselect__tags-wrap,
|
|
426
|
+
.multiselect__strong {
|
|
427
|
+
display: none;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.multiselect__placeholder {
|
|
431
|
+
color: var(--form-placeholder--active-color);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.wt-select--invalid,
|
|
439
|
+
.wt-select--invalid:hover {
|
|
440
|
+
.wt-label {
|
|
441
|
+
color: var(--false-color);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.multiselect {
|
|
445
|
+
::v-deep {
|
|
446
|
+
.multiselect__tags {
|
|
447
|
+
border-color: var(--false-color);
|
|
448
|
+
outline: none; // prevent outline overlapping false color
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.wt-select--disabled {
|
|
455
|
+
pointer-events: none;
|
|
456
|
+
|
|
457
|
+
.multiselect--disabled {
|
|
458
|
+
background: none;
|
|
459
|
+
opacity: 1;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.wt-select__arrow-caret ::v-deep .wt-icon__icon,
|
|
463
|
+
.wt-select__clear ::v-deep .wt-icon__icon {
|
|
464
|
+
fill: var(--icon-color-disabled);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.multiselect {
|
|
468
|
+
::v-deep {
|
|
469
|
+
.multiselect__tags {
|
|
470
|
+
background: var(--form-border--disabled-color);
|
|
471
|
+
border-color: var(--form-border--disabled-color);
|
|
472
|
+
|
|
473
|
+
.multiselect__placeholder {
|
|
474
|
+
color: var(--form-placeholder--disabled-color);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.wt-select--clearable {
|
|
482
|
+
.multiselect::v-deep {
|
|
483
|
+
.multiselect__tags {
|
|
484
|
+
padding: var(--select-tags-padding--clearable);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.multiselect__strong {
|
|
488
|
+
right: var(--select-badge-right-pos--clearable);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import WtSlider from '../wt-slider.vue';
|
|
3
|
+
|
|
4
|
+
describe('WtSlider', () => {
|
|
5
|
+
it('renders a component', () => {
|
|
6
|
+
const wrapper = shallowMount(WtSlider, {});
|
|
7
|
+
expect(wrapper.classes('wt-slider')).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<!-- We were trying to draw our own slider using <div> tags, but realizing all the limitations decided to use
|
|
2
|
+
the native input of type 'range', styling it as per Webitel needs for every of the most popular web browsers.
|
|
3
|
+
|
|
4
|
+
The biggest issue to solve was the vertical input. At the moment browsers do not support vertical input range having
|
|
5
|
+
custom styling, so we are using css rotation.
|
|
6
|
+
Dealing with rotation we realized rotated element is very hard to position correctly with no fixed height of the parent element.
|
|
7
|
+
Considering the fact parent height is always relative to it's childs height, we are manipulating the child width/height on rotation.
|
|
8
|
+
To achieve correct slider height we:
|
|
9
|
+
1. Rotate slider by 90deg, so the width of slider becomes 'heigth' of the parent.
|
|
10
|
+
2. Set the new slider width (which is now positioned from bottom to top) using fixed number of pixels, received with props.
|
|
11
|
+
3. Set the container element height to 100% so it is always calculated correctly depending on it`s child dimensions.
|
|
12
|
+
|
|
13
|
+
Until there are no possibility to style input range and position it vertically, we are rotating our slider with css
|
|
14
|
+
and swapping height/width of this component in order to have the correct output.
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div
|
|
19
|
+
class="wt-slider"
|
|
20
|
+
:class="{
|
|
21
|
+
'wt-slider--disabled': disabled,
|
|
22
|
+
'wt-slider--vertical': vertical,
|
|
23
|
+
}"
|
|
24
|
+
:style="{ height: verticalHeight }"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="wt-slider__wrapper"
|
|
28
|
+
:style="{ width: verticalHeight }"
|
|
29
|
+
>
|
|
30
|
+
<!-- The row above is needed in order to set correct component width when slider is vertical -->
|
|
31
|
+
<input
|
|
32
|
+
type="range"
|
|
33
|
+
class="wt-slider__slider"
|
|
34
|
+
:style="{ background: progressStyle }"
|
|
35
|
+
:min="min"
|
|
36
|
+
:max="max"
|
|
37
|
+
:step="step"
|
|
38
|
+
:value="value"
|
|
39
|
+
:disabled="disabled"
|
|
40
|
+
@input="inputHandler"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
export default {
|
|
48
|
+
name: 'wt-slider',
|
|
49
|
+
props: {
|
|
50
|
+
value: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 0,
|
|
53
|
+
},
|
|
54
|
+
disabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
vertical: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
min: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0,
|
|
65
|
+
},
|
|
66
|
+
max: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 100,
|
|
69
|
+
},
|
|
70
|
+
step: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 1,
|
|
73
|
+
},
|
|
74
|
+
// Height of vertical slider (px):
|
|
75
|
+
height: {
|
|
76
|
+
type: Number,
|
|
77
|
+
default: 100,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
progressStyle() { // To achieve the correct color styling:
|
|
82
|
+
const progressPercent = ((this.value - this.min) / (this.max - this.min)) * 100;
|
|
83
|
+
return `linear-gradient(to right, var(--accent-color) ${progressPercent}%, var(--secondary-color) 0%)`;
|
|
84
|
+
},
|
|
85
|
+
verticalHeight() { // in order to have correct parent height after slider rotation
|
|
86
|
+
return this.vertical ? `${this.height}px` : '100%';
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
inputHandler(event) {
|
|
91
|
+
this.$emit('input', +event.target.value);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<style lang="scss" scoped>
|
|
98
|
+
|
|
99
|
+
.wt-slider__wrapper {
|
|
100
|
+
width: var(--wt-slider-width)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.wt-slider__slider {
|
|
104
|
+
box-sizing: var(--wt-slider-box-sizing);
|
|
105
|
+
width: var(--wt-slider-width);
|
|
106
|
+
height: var(--wt-slider-height);
|
|
107
|
+
border: var(--wt-slider-border);
|
|
108
|
+
border-radius: var(--border-radius);
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
-webkit-appearance: none;
|
|
111
|
+
-moz-appearance: none;
|
|
112
|
+
|
|
113
|
+
&::-webkit-slider-thumb {
|
|
114
|
+
width: var(--wt-slider-pointer-size);
|
|
115
|
+
height: var(--wt-slider-pointer-size);
|
|
116
|
+
border: var(--wt-slider-border);
|
|
117
|
+
border-radius: var(--wt-slider-pointer-radius);
|
|
118
|
+
background: var(--main-color);
|
|
119
|
+
-webkit-appearance: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&::-webkit-slider-runnable-track {
|
|
123
|
+
-webkit-appearance: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&::-moz-range-thumb {
|
|
127
|
+
width: var(--wt-slider-pointer-size);
|
|
128
|
+
height: var(--wt-slider-pointer-size);
|
|
129
|
+
border: var(--wt-slider-border);
|
|
130
|
+
border-radius: var(--wt-slider-pointer-radius);
|
|
131
|
+
background: var(--main-color);
|
|
132
|
+
-moz-appearance: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&::-moz-range-track {
|
|
136
|
+
-moz-appearance: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&::-ms-thumb {
|
|
140
|
+
appearance: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&::-ms-track {
|
|
144
|
+
appearance: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.wt-slider--disabled {
|
|
149
|
+
.wt-slider__slider {
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
|
|
152
|
+
&::-webkit-slider-thumb {
|
|
153
|
+
display: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&::-moz-range-thumb {
|
|
157
|
+
display: none;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.wt-slider--vertical {
|
|
163
|
+
width: var(--wt-slider-vertical-container-width);
|
|
164
|
+
transform: var(--wt-slider-vertical-container-translation);
|
|
165
|
+
|
|
166
|
+
.wt-slider__wrapper {
|
|
167
|
+
transform: var(--wt-slider-vertical-transform);
|
|
168
|
+
transform-origin: var(--wt-slider-vertical-transform-origin);
|
|
169
|
+
|
|
170
|
+
.wt-slider__slider {
|
|
171
|
+
margin: 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import WtSwitcher from '../wt-switcher.vue';
|
|
3
|
+
import WtLabel from '../../wt-label/wt-label.vue';
|
|
4
|
+
|
|
5
|
+
describe('WtSwitcher', () => {
|
|
6
|
+
it('renders a component', () => {
|
|
7
|
+
const wrapper = shallowMount(WtSwitcher, {
|
|
8
|
+
stubs: { WtLabel },
|
|
9
|
+
});
|
|
10
|
+
expect(wrapper.classes('wt-switcher')).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('renders label text when passed', () => {
|
|
14
|
+
const label = 'Hello there';
|
|
15
|
+
const wrapper = shallowMount(WtSwitcher, {
|
|
16
|
+
stubs: { WtLabel },
|
|
17
|
+
propsData: { label },
|
|
18
|
+
});
|
|
19
|
+
expect(wrapper.find('.wt-switcher__label').text()).toBe(label);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('toggles passed value at click', () => {
|
|
23
|
+
const value = true;
|
|
24
|
+
const wrapper = shallowMount(WtSwitcher, {
|
|
25
|
+
stubs: { WtLabel },
|
|
26
|
+
propsData: { value },
|
|
27
|
+
});
|
|
28
|
+
wrapper.find('.wt-switcher__wrapper').trigger('click');
|
|
29
|
+
expect(wrapper.emitted().change.pop()).toEqual([!value]);
|
|
30
|
+
});
|
|
31
|
+
});
|