mediacube-ui 0.1.346 → 0.1.347
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/CHANGELOG.md +2 -0
- package/dist/0.mediacube-ui.umd.js +50 -0
- package/dist/assets/img/icons.3b7d59b2f49c67a2a3a4566b8ab233fd.svg +1 -0
- package/dist/assets/img/no_table_data.236cd56f46cfb71fc363b008d4ca70d5.png +0 -0
- package/dist/assets/img/no_user.e0030d6e54e2400e1181fd22b83cf8ae.png +0 -0
- package/dist/mediacube-ui.umd.js +1 -0
- package/package.json +14 -16
- package/src/assets/tokens/tokens.json +5 -0
- package/dist/mediacube-ui.common.js +0 -378
- package/src/elements/McAvatar/McAvatar.vue +0 -274
- package/src/elements/McBadge/McBadge.vue +0 -148
- package/src/elements/McButton/McButton.vue +0 -841
- package/src/elements/McChip/McChip.vue +0 -300
- package/src/elements/McCropper/McCropper.vue +0 -133
- package/src/elements/McDate/McDate.vue +0 -105
- package/src/elements/McDatePicker/McDatePicker.vue +0 -902
- package/src/elements/McField/McFieldCheckbox/McFieldCheckbox.vue +0 -332
- package/src/elements/McField/McFieldRadio/McFieldRadioButton/McFieldRadioButton.vue +0 -201
- package/src/elements/McField/McFieldRadio/McFieldRadioGroup/McFieldRadioGroup.vue +0 -194
- package/src/elements/McField/McFieldSelect/McFieldSelect.vue +0 -1087
- package/src/elements/McField/McFieldText/McFieldText.vue +0 -969
- package/src/elements/McField/McFieldToggle/McFieldToggle.vue +0 -268
- package/src/elements/McInfinityLoadingIndicator/McInfinityLoadingIndicator.vue +0 -97
- package/src/elements/McNotification/McNotification.vue +0 -209
- package/src/elements/McProgress/McProgress.vue +0 -218
- package/src/elements/McRangeSlider/McRangeSlider.vue +0 -195
- package/src/elements/McSeparator/McSeparator.vue +0 -143
- package/src/elements/McSlideUpDown/McSlideUpDown.vue +0 -157
- package/src/elements/McSvgIcon/McSvgIcon.vue +0 -127
- package/src/elements/McTabs/McTab/McTab.vue +0 -187
- package/src/elements/McTabs/McTabs/McTabs.vue +0 -531
- package/src/elements/McTitle/McTitle.vue +0 -365
- package/src/elements/McTooltip/McTooltip.vue +0 -334
- package/src/helpers/consts.js +0 -3
- package/src/helpers/delayedAction.js +0 -26
- package/src/helpers/storybookFunctions.js +0 -20
- package/src/helpers/storybookVariables.js +0 -24
- package/src/mixins/equalFieldHeight.js +0 -59
- package/src/mixins/fieldErrors.js +0 -28
- package/src/patterns/McAccordion/McAccordion.vue +0 -53
- package/src/patterns/McCells/McCell/McCell.vue +0 -101
- package/src/patterns/McChat/McChat.vue +0 -305
- package/src/patterns/McChat/McChatComment/McChatComment.vue +0 -265
- package/src/patterns/McChat/McChatForm/McChatForm.vue +0 -147
- package/src/patterns/McCollapse/McCollapse.vue +0 -280
- package/src/patterns/McDrawer/McDrawer.vue +0 -146
- package/src/patterns/McDropdown/McDropdown.vue +0 -247
- package/src/patterns/McDropdown/McDropdownPanel/McDropdownPanel.vue +0 -40
- package/src/patterns/McFakeScroll/McFakeScroll.vue +0 -277
- package/src/patterns/McFilter/McFilter.vue +0 -847
- package/src/patterns/McFilter/McFilterChip/McFilterChip.vue +0 -83
- package/src/patterns/McFilter/McFilterTags/McFilterTags.vue +0 -374
- package/src/patterns/McFilter/McFilterTypeDate/McFilterTypeDate.vue +0 -70
- package/src/patterns/McFilter/McFilterTypeRange/McFilterTypeRange.vue +0 -132
- package/src/patterns/McFilter/McFilterTypeRelation/McFilterTypeRelation.vue +0 -221
- package/src/patterns/McFilter/McFilterTypeSimple/McFilterTypeSimple.vue +0 -161
- package/src/patterns/McFilter/McFilterTypeText/McFilterTypeText.vue +0 -62
- package/src/patterns/McGrid/McGridCol/McGridCol.vue +0 -165
- package/src/patterns/McGrid/McGridRow/McGridRow.vue +0 -158
- package/src/patterns/McModal/McModal.vue +0 -680
- package/src/patterns/McOverlay/McOverlay.vue +0 -78
- package/src/patterns/McPreview/McPreview.vue +0 -118
- package/src/patterns/McSideBar/McSideBar/McSideBar.vue +0 -387
- package/src/patterns/McSideBar/McSideBarBottom/McSideBarBottom.vue +0 -125
- package/src/patterns/McSideBar/McSideBarButton/McSideBarButton.vue +0 -252
- package/src/patterns/McSideBar/McSideBarCenter/McSideBarCenter.vue +0 -367
- package/src/patterns/McSideBar/McSideBarTop/McSideBarTop.vue +0 -238
- package/src/patterns/McStack/McStack.vue +0 -158
- package/src/patterns/McTable/McTable/McTable.vue +0 -854
- package/src/patterns/McTable/McTableCol/McTableCol.vue +0 -296
- package/src/patterns/McTableCard/McTableCard.vue +0 -135
- package/src/patterns/McTableCard/McTableCardHeader/McTableCardHeader.vue +0 -74
- package/src/patterns/McTopBar/McTopBar.vue +0 -153
- package/src/patterns/McWrapScroll/McWrapScroll.vue +0 -291
- package/src/styles/_functions.scss +0 -187
- package/src/styles/_mixins.scss +0 -612
- package/src/styles/_spacing.scss +0 -33
- package/src/styles/_variables.scss +0 -23
- package/src/styles/global.scss +0 -308
- package/src/styles/main.scss +0 -4
- package/src/styles/table.scss +0 -10
- package/src/styles/toast.scss +0 -55
- package/src/templates/layouts/McContentFixed/McContentFixed.vue +0 -60
- package/src/templates/layouts/McMain/McMain.vue +0 -115
- package/src/templates/layouts/McRoot/McRoot.vue +0 -45
- package/src/tokens/animations.scss +0 -9
- package/src/tokens/border-radius.scss +0 -26
- package/src/tokens/box-shadows.scss +0 -28
- package/src/tokens/colors.scss +0 -82
- package/src/tokens/durations.scss +0 -7
- package/src/tokens/easings.scss +0 -6
- package/src/tokens/font-families.scss +0 -8
- package/src/tokens/font-sizes.scss +0 -23
- package/src/tokens/font-weights.scss +0 -9
- package/src/tokens/gradients.scss +0 -19
- package/src/tokens/letter-spacings.scss +0 -6
- package/src/tokens/line-heights.scss +0 -22
- package/src/tokens/media-queries.scss +0 -32
- package/src/tokens/opacities.scss +0 -8
- package/src/tokens/sizes.scss +0 -47
- package/src/tokens/spacings.scss +0 -38
- package/src/tokens/z-indexes.scss +0 -14
- package/src/utils/dayjs.js +0 -19
- package/src/utils/filters.js +0 -11
- package/src/utils/getTokens.js +0 -41
- package/src/utils/load-icons.js +0 -3
- package/src/utils/treeSearch.js +0 -30
- package/src/utils/webFontLoader.js +0 -12
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="mc-drawer">
|
|
3
|
-
<div v-if="$slots.title || title" class="mc-drawer__header">
|
|
4
|
-
<!-- @slot Слот заголовка -->
|
|
5
|
-
<slot name="title">
|
|
6
|
-
<mc-title variation="subtitle" :ellipsis="titleEllipsis" weight="semi-bold">
|
|
7
|
-
{{ title }}
|
|
8
|
-
</mc-title>
|
|
9
|
-
</slot>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="mc-drawer__body">
|
|
12
|
-
<div class="mc-drawer__tint"></div>
|
|
13
|
-
<div class="mc-drawer__body-inner">
|
|
14
|
-
<!-- @slot Слот контента -->
|
|
15
|
-
<slot />
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
<div v-if="$slots.footer" class="mc-drawer__footer">
|
|
19
|
-
<!-- @slot Слот футера -->
|
|
20
|
-
<slot name="footer" />
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<button v-if="closeVisible" type="button" class="mc-drawer__btn-close" @click.prevent="handleClose">
|
|
24
|
-
<mc-svg-icon class="mc-drawer__icon-close" :name="iconClose" />
|
|
25
|
-
<mc-svg-icon class="mc-drawer__icon-close--small" :name="iconClose" size="200" />
|
|
26
|
-
</button>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script>
|
|
31
|
-
import McSvgIcon from '../../elements/McSvgIcon/McSvgIcon'
|
|
32
|
-
import McTitle from '../../elements/McTitle/McTitle'
|
|
33
|
-
/**
|
|
34
|
-
* More info: https://officert.github.io/vue-slideout-panel
|
|
35
|
-
*/
|
|
36
|
-
export default {
|
|
37
|
-
name: 'McDrawer',
|
|
38
|
-
components: {
|
|
39
|
-
McSvgIcon,
|
|
40
|
-
McTitle,
|
|
41
|
-
},
|
|
42
|
-
props: {
|
|
43
|
-
/**
|
|
44
|
-
* Заголовок
|
|
45
|
-
*/
|
|
46
|
-
title: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: '',
|
|
49
|
-
},
|
|
50
|
-
titleEllipsis: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
53
|
-
},
|
|
54
|
-
/**
|
|
55
|
-
* Нужна ли кнопка
|
|
56
|
-
* закрытия в шапке
|
|
57
|
-
*/
|
|
58
|
-
closeVisible: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: true,
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Тип иконки
|
|
64
|
-
* закрытия в шапке
|
|
65
|
-
*/
|
|
66
|
-
iconClose: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: 'close',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
methods: {
|
|
73
|
-
handleClose() {
|
|
74
|
-
/**
|
|
75
|
-
* Событие закрытия панели
|
|
76
|
-
* @property {Object}
|
|
77
|
-
*/
|
|
78
|
-
this.$emit('close-panel', {})
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<style lang="scss">
|
|
85
|
-
@import '../../styles/mixins';
|
|
86
|
-
.mc-drawer {
|
|
87
|
-
$block-name: &;
|
|
88
|
-
|
|
89
|
-
display: flex;
|
|
90
|
-
flex-direction: column;
|
|
91
|
-
height: 100%;
|
|
92
|
-
@include custom-scroll();
|
|
93
|
-
|
|
94
|
-
&__header {
|
|
95
|
-
@include reset-text-indents();
|
|
96
|
-
padding: 18px $space-600 18px $space-200;
|
|
97
|
-
border-bottom: 1px solid $color-hover-gray;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&__body {
|
|
101
|
-
position: relative;
|
|
102
|
-
flex: 1 1 auto;
|
|
103
|
-
min-height: 0;
|
|
104
|
-
overflow-y: auto;
|
|
105
|
-
height: 100%;
|
|
106
|
-
&-inner {
|
|
107
|
-
max-height: 100%;
|
|
108
|
-
height: 100%;
|
|
109
|
-
overflow-y: auto;
|
|
110
|
-
padding: $space-400 $space-200;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
&__footer {
|
|
114
|
-
border-top: 1px solid $color-hover-gray;
|
|
115
|
-
padding: $space-200 $space-200;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&__tint {
|
|
119
|
-
@include position(absolute, 0 5px null 0);
|
|
120
|
-
height: $size-400;
|
|
121
|
-
background: linear-gradient(180deg, $color-white 0%, rgba(255, 255, 255, 0) 100%);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
&__btn-close {
|
|
125
|
-
@include reset-btn();
|
|
126
|
-
@include position(absolute, $space-100 $space-100 null null);
|
|
127
|
-
@include close-link();
|
|
128
|
-
z-index: 1;
|
|
129
|
-
padding: $space-100;
|
|
130
|
-
}
|
|
131
|
-
&__icon-close {
|
|
132
|
-
@include size($size-300);
|
|
133
|
-
&--small {
|
|
134
|
-
display: none;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
@media #{$media-query-m-down} {
|
|
138
|
-
#{$block-name}__icon-close {
|
|
139
|
-
display: none;
|
|
140
|
-
&--small {
|
|
141
|
-
display: block;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-click-outside="handleClickOutside" class="mc-dropdown" :class="dropdownClasses">
|
|
3
|
-
<div class="mc-dropdown__toggle" :class="toggleClasses" tabindex="0" @keyup.esc="closeDropdown">
|
|
4
|
-
<!-- @slot активатора переключения состояния -->
|
|
5
|
-
<slot name="activator" />
|
|
6
|
-
</div>
|
|
7
|
-
<div ref="dropdown_body" :style="dropdownBodyStyles" class="mc-dropdown__body">
|
|
8
|
-
<!-- @slot контента -->
|
|
9
|
-
<slot />
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import VueClickOutside from 'vue-click-outside'
|
|
16
|
-
import _throttle from 'lodash/throttle'
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'McDropdown',
|
|
20
|
-
directives: {
|
|
21
|
-
'click-outside': VueClickOutside,
|
|
22
|
-
},
|
|
23
|
-
props: {
|
|
24
|
-
/**
|
|
25
|
-
* Состояние видимости контента
|
|
26
|
-
*/
|
|
27
|
-
value: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false,
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* Выравнивание
|
|
33
|
-
* контента: 'left', 'right', 'auto'
|
|
34
|
-
*/
|
|
35
|
-
position: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: 'left',
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Направление отображения
|
|
41
|
-
* контента: 'top', 'bottom', 'auto'
|
|
42
|
-
*/
|
|
43
|
-
listPosition: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: 'bottom',
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Минимальная ширина выпадаюзего списка
|
|
49
|
-
*/
|
|
50
|
-
listMinWidth: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: 'inherit',
|
|
53
|
-
},
|
|
54
|
-
/**
|
|
55
|
-
* Необходимо ли вращение иконки
|
|
56
|
-
* (элементу для вращения, необходимо добавить класс 'rotate')
|
|
57
|
-
*/
|
|
58
|
-
rotateIcon: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: true,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
local_list_position: null,
|
|
66
|
-
local_position: null,
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
computed: {
|
|
70
|
-
dropdownClasses() {
|
|
71
|
-
return {
|
|
72
|
-
[`mc-dropdown--position-${this.local_position}`]: this.local_position,
|
|
73
|
-
[`mc-dropdown--list-position-${this.local_list_position}`]: this.local_list_position,
|
|
74
|
-
['mc-dropdown--is-open']: this.value,
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
dropdownBodyStyles() {
|
|
78
|
-
return {
|
|
79
|
-
'min-width': this.listMinWidth,
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
toggleClasses() {
|
|
83
|
-
return {
|
|
84
|
-
['mc-dropdown__toggle--rotate-icon']: this.rotateIcon,
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
activator() {
|
|
88
|
-
return this.$slots.activator[0].elm
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
watch: {
|
|
93
|
-
$route() {
|
|
94
|
-
this.value && this.closeDropdown()
|
|
95
|
-
},
|
|
96
|
-
value() {
|
|
97
|
-
this.$nextTick(() => {
|
|
98
|
-
this.calculateDropdownPosition()
|
|
99
|
-
})
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
mounted() {
|
|
104
|
-
this.activator.addEventListener('click', this.toggleDropdown)
|
|
105
|
-
window.addEventListener('resize', this.throttledCalculateDropdownPosition)
|
|
106
|
-
window.addEventListener('transitionrun', this.throttledCalculateDropdownPosition)
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
beforeDestroy() {
|
|
110
|
-
this.activator.removeEventListener('click', this.toggleDropdown)
|
|
111
|
-
window.removeEventListener('resize', this.throttledCalculateDropdownPosition)
|
|
112
|
-
window.removeEventListener('transitionrun', this.throttledCalculateDropdownPosition)
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
methods: {
|
|
116
|
-
toggleDropdown() {
|
|
117
|
-
/**
|
|
118
|
-
* Событие по тогглу
|
|
119
|
-
* @property {Boolean}
|
|
120
|
-
*/
|
|
121
|
-
this.$emit('input', !this.value)
|
|
122
|
-
},
|
|
123
|
-
handleClickOutside(e) {
|
|
124
|
-
if (!this.value || !document.body.contains(e.target)) return
|
|
125
|
-
this.value && this.closeDropdown()
|
|
126
|
-
},
|
|
127
|
-
closeDropdown() {
|
|
128
|
-
this.$emit('input', false)
|
|
129
|
-
},
|
|
130
|
-
calculateDropdownPosition() {
|
|
131
|
-
if (!this.$refs.dropdown_body) return
|
|
132
|
-
const rect = this.activator.getBoundingClientRect()
|
|
133
|
-
const space_below = window.innerHeight - rect.bottom
|
|
134
|
-
const space_left = window.innerWidth - rect.left
|
|
135
|
-
const { offsetHeight: dropdown_height, offsetWidth: dropdown_width } = this.$refs.dropdown_body
|
|
136
|
-
// Определяем направление отображения списка
|
|
137
|
-
const auto_list_position = space_below < dropdown_height ? 'top' : 'bottom'
|
|
138
|
-
const auto_position = space_left > dropdown_width ? 'left' : 'right'
|
|
139
|
-
// Устанавливаем значения в зависимости от position
|
|
140
|
-
this.local_list_position = this.listPosition === 'auto' ? auto_list_position : this.listPosition
|
|
141
|
-
this.local_position = this.position === 'auto' ? auto_position : this.position
|
|
142
|
-
},
|
|
143
|
-
throttledCalculateDropdownPosition: _throttle(function() {
|
|
144
|
-
this.calculateDropdownPosition()
|
|
145
|
-
}, 200),
|
|
146
|
-
},
|
|
147
|
-
}
|
|
148
|
-
</script>
|
|
149
|
-
|
|
150
|
-
<style lang="scss">
|
|
151
|
-
@import '../../styles/mixins';
|
|
152
|
-
@import '../../tokens/z-indexes';
|
|
153
|
-
@import '../../tokens/durations';
|
|
154
|
-
.mc-dropdown {
|
|
155
|
-
$block-name: &;
|
|
156
|
-
|
|
157
|
-
position: relative;
|
|
158
|
-
display: inline-block;
|
|
159
|
-
|
|
160
|
-
&__toggle {
|
|
161
|
-
outline: none;
|
|
162
|
-
@include reset-text-indents();
|
|
163
|
-
.mc-svg-icon {
|
|
164
|
-
transition: all $duration-s;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&__body {
|
|
169
|
-
@include position(absolute, null null null 0);
|
|
170
|
-
z-index: $z-index-dropdown;
|
|
171
|
-
height: 0;
|
|
172
|
-
overflow: hidden;
|
|
173
|
-
margin: 0;
|
|
174
|
-
background-color: transparent;
|
|
175
|
-
opacity: 0;
|
|
176
|
-
visibility: hidden;
|
|
177
|
-
transition: opacity $duration-s, transform $duration-s;
|
|
178
|
-
|
|
179
|
-
.mc-button {
|
|
180
|
-
&:not(.nuxt-link-active):not(.mc-button--is-active):not(.mc-button--variation-red-flat) {
|
|
181
|
-
&:hover {
|
|
182
|
-
.mc-button__background {
|
|
183
|
-
opacity: 0 !important;
|
|
184
|
-
}
|
|
185
|
-
background-color: fade-out($color-purple, 0.9);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
&--list-position-top {
|
|
192
|
-
#{$block-name} {
|
|
193
|
-
&__body {
|
|
194
|
-
bottom: 100%;
|
|
195
|
-
margin-bottom: $space-100;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
&--list-position-bottom {
|
|
201
|
-
#{$block-name} {
|
|
202
|
-
&__body {
|
|
203
|
-
top: 100%;
|
|
204
|
-
margin-top: $space-100;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&--is-open {
|
|
210
|
-
#{$block-name} {
|
|
211
|
-
&__body {
|
|
212
|
-
height: auto;
|
|
213
|
-
visibility: visible;
|
|
214
|
-
overflow: visible;
|
|
215
|
-
opacity: 1;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
#{$block-name} {
|
|
220
|
-
&__toggle--rotate-icon {
|
|
221
|
-
.rotate {
|
|
222
|
-
position: relative;
|
|
223
|
-
transform: rotate(180deg);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
&--position-right {
|
|
230
|
-
#{$block-name} {
|
|
231
|
-
&__body {
|
|
232
|
-
inset-inline-start: auto;
|
|
233
|
-
inset-inline-end: 0;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
&--position-left {
|
|
239
|
-
#{$block-name} {
|
|
240
|
-
&__body {
|
|
241
|
-
inset-inline-start: 0;
|
|
242
|
-
inset-inline-end: auto;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="mc-dropdown-panel">
|
|
3
|
-
<!-- @slot Слот контента -->
|
|
4
|
-
<slot />
|
|
5
|
-
</section>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
name: 'McDropdownPanel',
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<style lang="scss">
|
|
15
|
-
@import '../../../styles/mixins';
|
|
16
|
-
@import '../../../tokens/box-shadows';
|
|
17
|
-
.mc-dropdown-panel {
|
|
18
|
-
$block-name: &;
|
|
19
|
-
|
|
20
|
-
box-shadow: $shadow-s;
|
|
21
|
-
border-radius: $radius-150;
|
|
22
|
-
background-color: $color-white;
|
|
23
|
-
padding: $space-100;
|
|
24
|
-
max-width: 320px;
|
|
25
|
-
|
|
26
|
-
&:empty {
|
|
27
|
-
display: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.mc-button {
|
|
31
|
-
&--size-m {
|
|
32
|
-
font-weight: $font-weight-medium;
|
|
33
|
-
padding: $space-100;
|
|
34
|
-
.mc-svg-icon {
|
|
35
|
-
@include size($size-300);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
</style>
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="main" :class="mainClasses">
|
|
3
|
-
<div class="mc-fake-scroll__main">
|
|
4
|
-
<!-- @slot Слот для <strong>одного (!)</strong> элемента со скроллом -->
|
|
5
|
-
<slot />
|
|
6
|
-
</div>
|
|
7
|
-
<div
|
|
8
|
-
ref="track"
|
|
9
|
-
:class="trackClasses"
|
|
10
|
-
@mousedown.stop="onFakeScrollBarTrackMouseDown"
|
|
11
|
-
@click.stop="onFakeScrollBarTrackClick"
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
ref="thumb"
|
|
15
|
-
class="mc-fake-scroll__thumb"
|
|
16
|
-
:style="thumbStyles"
|
|
17
|
-
@mousedown.stop="onFakeScrollBarMouseDown"
|
|
18
|
-
></div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script>
|
|
24
|
-
export default {
|
|
25
|
-
name: 'McFakeScroll',
|
|
26
|
-
props: {
|
|
27
|
-
/**
|
|
28
|
-
* Значение медиа-запроса (из токенов),
|
|
29
|
-
* при котором скроллбар
|
|
30
|
-
* будет виден всегда:
|
|
31
|
-
* `xl`, `xl-down`, `l`, `l-down`, `m`, `m-down` и т.д.
|
|
32
|
-
*/
|
|
33
|
-
visible: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
data() {
|
|
39
|
-
return {
|
|
40
|
-
hasScroll: false,
|
|
41
|
-
thumbBox: null,
|
|
42
|
-
trackBox: null,
|
|
43
|
-
thumbHeight: 0,
|
|
44
|
-
scrollRatio: 1,
|
|
45
|
-
trackIsClicked: false,
|
|
46
|
-
dragOptions: {
|
|
47
|
-
startClientPos: 0,
|
|
48
|
-
distance: 0,
|
|
49
|
-
mouseIsDown: false,
|
|
50
|
-
},
|
|
51
|
-
scrollElContentHeight: null,
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
computed: {
|
|
55
|
-
thumbStyles() {
|
|
56
|
-
return {
|
|
57
|
-
height: `${this.thumbHeight}px`,
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
scrollEl() {
|
|
62
|
-
return this.$slots.default ? this.$slots.default[0].elm : null
|
|
63
|
-
},
|
|
64
|
-
mainClasses() {
|
|
65
|
-
return {
|
|
66
|
-
'mc-fake-scroll': true,
|
|
67
|
-
[`mc-fake-scroll--visible${this.visible && `-${this.visible}`}`]: this.hasScroll,
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
trackClasses() {
|
|
71
|
-
return {
|
|
72
|
-
'mc-fake-scroll__track': true,
|
|
73
|
-
'mc-fake-scroll__track--visible': this.hasScroll,
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
mounted() {
|
|
78
|
-
this.scrollEl && this.scrollEl.addEventListener('scroll', this.onFakeScrollBarContentScroll)
|
|
79
|
-
|
|
80
|
-
this.$nextTick(() => {
|
|
81
|
-
this.updateData()
|
|
82
|
-
})
|
|
83
|
-
window.addEventListener('resize', this.resize)
|
|
84
|
-
|
|
85
|
-
document.documentElement.addEventListener('mousemove', this.onFakeScrollBarMouseMove)
|
|
86
|
-
document.documentElement.addEventListener('mouseup', this.onFakeScrollBarMouseUp)
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
beforeDestroy() {
|
|
90
|
-
this.scrollEl && this.scrollEl.removeEventListener('scroll', this.onFakeScrollBarContentScroll)
|
|
91
|
-
document.documentElement.removeEventListener('mousemove', this.onFakeScrollBarMouseMove)
|
|
92
|
-
document.documentElement.removeEventListener('mouseup', this.onFakeScrollBarMouseUp)
|
|
93
|
-
|
|
94
|
-
window.removeEventListener('resize', this.resize)
|
|
95
|
-
},
|
|
96
|
-
methods: {
|
|
97
|
-
resize() {
|
|
98
|
-
this.updateData()
|
|
99
|
-
},
|
|
100
|
-
updateData() {
|
|
101
|
-
this.checkScroll()
|
|
102
|
-
this.setBoxes()
|
|
103
|
-
this.setThumbHeight()
|
|
104
|
-
this.setScrollRatio()
|
|
105
|
-
this.scrollElContentHeight = this.scrollEl.scrollHeight
|
|
106
|
-
},
|
|
107
|
-
resetData() {
|
|
108
|
-
this.scrollEl.scrollTo(0, 0)
|
|
109
|
-
this.scrollElContentHeight = this.scrollEl.scrollHeight
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
this.updateData()
|
|
112
|
-
}, 0)
|
|
113
|
-
},
|
|
114
|
-
checkScroll() {
|
|
115
|
-
this.hasScroll = false
|
|
116
|
-
if (this.scrollEl) {
|
|
117
|
-
this.hasScroll = this.scrollEl.clientHeight < this.scrollEl.scrollHeight
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
setThumbHeight() {
|
|
121
|
-
if (this.scrollEl) {
|
|
122
|
-
const thumbRatio = Math.min(this.scrollEl.clientHeight / this.scrollEl.scrollHeight, 1.0)
|
|
123
|
-
this.thumbHeight = this.scrollEl.clientHeight * thumbRatio
|
|
124
|
-
if (this.$refs.thumb) {
|
|
125
|
-
this.thumbBox.height = this.$refs.thumb.getBoundingClientRect().height
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
setScrollRatio() {
|
|
130
|
-
if (this.thumbBox && this.trackBox) {
|
|
131
|
-
const availableTrackWay = this.trackBox.height - this.thumbHeight
|
|
132
|
-
const availableContentWay = this.scrollEl.scrollHeight - this.scrollEl.clientHeight
|
|
133
|
-
this.scrollRatio = Math.min(availableTrackWay / availableContentWay, 1.0)
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
setBoxes() {
|
|
137
|
-
this.thumbBox = this.getBoxPos(this.$refs.thumb)
|
|
138
|
-
this.trackBox = this.getBoxPos(this.$refs.track)
|
|
139
|
-
},
|
|
140
|
-
getBoxPos(el) {
|
|
141
|
-
if (!el) return null
|
|
142
|
-
const box = el.getBoundingClientRect()
|
|
143
|
-
return {
|
|
144
|
-
height: box.height,
|
|
145
|
-
bottom: box.bottom,
|
|
146
|
-
top: box.top + window.pageYOffset,
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
onFakeScrollBarTrackMouseDown(e) {
|
|
151
|
-
this.updateData()
|
|
152
|
-
let pos = e.clientY - this.trackBox.top
|
|
153
|
-
if (pos > this.trackBox.height - this.thumbBox.height * 0.5) {
|
|
154
|
-
pos -= this.thumbBox.height
|
|
155
|
-
} else if (pos > this.thumbBox.height * 0.5) {
|
|
156
|
-
pos -= this.thumbBox.height * 0.5
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this.trackIsClicked = true
|
|
160
|
-
this.scrollEl.scrollTo({
|
|
161
|
-
top: pos / this.scrollRatio,
|
|
162
|
-
behavior: 'smooth',
|
|
163
|
-
})
|
|
164
|
-
},
|
|
165
|
-
onFakeScrollBarTrackClick() {
|
|
166
|
-
this.trackIsClicked = false
|
|
167
|
-
},
|
|
168
|
-
onFakeScrollBarMouseDown(e) {
|
|
169
|
-
this.dragOptions.startClientPos = e.clientY
|
|
170
|
-
this.dragOptions.mouseIsDown = true
|
|
171
|
-
this.setBoxes()
|
|
172
|
-
document.body.classList.add('no-user-select')
|
|
173
|
-
},
|
|
174
|
-
onFakeScrollBarMouseMove(e) {
|
|
175
|
-
if (!this.dragOptions.mouseIsDown) return
|
|
176
|
-
|
|
177
|
-
this.setThumbHeight()
|
|
178
|
-
this.setScrollRatio()
|
|
179
|
-
|
|
180
|
-
this.dragOptions.distance = e.clientY - this.dragOptions.startClientPos
|
|
181
|
-
|
|
182
|
-
let calculateTopPos = this.thumbBox.top - this.trackBox.top + this.dragOptions.distance
|
|
183
|
-
this.setThumbPos(calculateTopPos)
|
|
184
|
-
this.scrollEl.scrollTo(0, calculateTopPos / this.scrollRatio)
|
|
185
|
-
},
|
|
186
|
-
setThumbPos(pos) {
|
|
187
|
-
if (pos < 0) {
|
|
188
|
-
this.$refs.thumb.style.top = '0px'
|
|
189
|
-
} else if (pos + this.thumbBox.height > this.trackBox.height) {
|
|
190
|
-
this.$refs.thumb.style.top = `${this.trackBox.height - this.thumbBox.height}px`
|
|
191
|
-
} else {
|
|
192
|
-
this.$refs.thumb.style.top = `${pos}px`
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
onFakeScrollBarMouseUp() {
|
|
196
|
-
this.dragOptions.mouseIsDown = false
|
|
197
|
-
document.body.classList.remove('no-user-select')
|
|
198
|
-
},
|
|
199
|
-
onFakeScrollBarContentScroll(e) {
|
|
200
|
-
const startScrollElContentHeight = this.scrollElContentHeight
|
|
201
|
-
if (this.dragOptions.mouseIsDown || this.trackIsClicked) return
|
|
202
|
-
|
|
203
|
-
this.updateData()
|
|
204
|
-
const topPos = e.target.scrollTop
|
|
205
|
-
this.setThumbPos(topPos * this.scrollRatio)
|
|
206
|
-
|
|
207
|
-
if (startScrollElContentHeight !== e.target.scrollHeight) {
|
|
208
|
-
this.scrollEl.scrollTo(0, e.target.scrollHeight * this.scrollRatio)
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
}
|
|
213
|
-
</script>
|
|
214
|
-
|
|
215
|
-
<style lang="scss">
|
|
216
|
-
@import '../../styles/mixins';
|
|
217
|
-
@mixin track-visibility() {
|
|
218
|
-
right: 0;
|
|
219
|
-
width: 7px;
|
|
220
|
-
opacity: 1;
|
|
221
|
-
}
|
|
222
|
-
.mc-fake-scroll {
|
|
223
|
-
$block-name: &;
|
|
224
|
-
&__main {
|
|
225
|
-
> * {
|
|
226
|
-
@include hide-scrollbar();
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
position: relative;
|
|
230
|
-
&__track {
|
|
231
|
-
@include position(absolute, 0 -7px 0 null);
|
|
232
|
-
width: 0;
|
|
233
|
-
opacity: 0;
|
|
234
|
-
background-color: $color-transparent;
|
|
235
|
-
z-index: 101;
|
|
236
|
-
display: block;
|
|
237
|
-
}
|
|
238
|
-
&__thumb {
|
|
239
|
-
@include position(absolute, 0 1px null 1px);
|
|
240
|
-
background-color: $color-outline-gray;
|
|
241
|
-
height: 100px;
|
|
242
|
-
border-radius: $radius-100;
|
|
243
|
-
&:hover,
|
|
244
|
-
&:active {
|
|
245
|
-
background-color: $color-gray;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
&:hover {
|
|
249
|
-
#{$block-name}__track--visible {
|
|
250
|
-
@include track-visibility();
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
&__track--visible:active {
|
|
254
|
-
@include track-visibility();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
&--visible {
|
|
258
|
-
#{$block-name}__track {
|
|
259
|
-
@include track-visibility();
|
|
260
|
-
}
|
|
261
|
-
@each $name, $value in $token-media-queries {
|
|
262
|
-
&-#{$name} {
|
|
263
|
-
@media #{$value} {
|
|
264
|
-
#{$block-name}__track {
|
|
265
|
-
@include track-visibility();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
.no-user-select {
|
|
273
|
-
-webkit-user-select: none;
|
|
274
|
-
-moz-user-select: none;
|
|
275
|
-
-ms-user-select: none;
|
|
276
|
-
}
|
|
277
|
-
</style>
|