mediacube-ui 0.1.347 → 0.1.349

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/mediacube-ui.common.js +384 -0
  3. package/package.json +11 -4
  4. package/src/elements/McAvatar/McAvatar.vue +276 -0
  5. package/src/elements/McBadge/McBadge.vue +153 -0
  6. package/src/elements/McButton/McButton.vue +850 -0
  7. package/src/elements/McChip/McChip.vue +305 -0
  8. package/src/elements/McCropper/McCropper.vue +135 -0
  9. package/src/elements/McDate/McDate.vue +107 -0
  10. package/src/elements/McDatePicker/McDatePicker.vue +910 -0
  11. package/src/elements/McField/McFieldCheckbox/McFieldCheckbox.vue +339 -0
  12. package/src/elements/McField/McFieldRadio/McFieldRadioButton/McFieldRadioButton.vue +207 -0
  13. package/src/elements/McField/McFieldRadio/McFieldRadioGroup/McFieldRadioGroup.vue +198 -0
  14. package/src/elements/McField/McFieldSelect/McFieldSelect.vue +1088 -0
  15. package/src/elements/McField/McFieldText/McFieldText.vue +977 -0
  16. package/src/elements/McField/McFieldToggle/McFieldToggle.vue +273 -0
  17. package/src/elements/McInfinityLoadingIndicator/McInfinityLoadingIndicator.vue +97 -0
  18. package/src/elements/McNotification/McNotification.vue +215 -0
  19. package/src/elements/McProgress/McProgress.vue +223 -0
  20. package/src/elements/McRangeSlider/McRangeSlider.vue +199 -0
  21. package/src/elements/McSeparator/McSeparator.vue +143 -0
  22. package/src/elements/McSlideUpDown/McSlideUpDown.vue +157 -0
  23. package/src/elements/McSvgIcon/McSvgIcon.vue +128 -0
  24. package/src/elements/McTabs/McTab/McTab.vue +189 -0
  25. package/src/elements/McTabs/McTabs/McTabs.vue +538 -0
  26. package/src/elements/McTitle/McTitle.vue +370 -0
  27. package/src/elements/McTooltip/McTooltip.vue +339 -0
  28. package/src/helpers/consts.js +3 -0
  29. package/src/helpers/delayedAction.js +26 -0
  30. package/src/helpers/storybookFunctions.js +19 -0
  31. package/src/helpers/storybookVariables.js +24 -0
  32. package/src/mixins/equalFieldHeight.js +59 -0
  33. package/src/mixins/fieldErrors.js +28 -0
  34. package/src/patterns/McAccordion/McAccordion.vue +53 -0
  35. package/src/patterns/McCells/McCell/McCell.vue +102 -0
  36. package/src/patterns/McChat/McChat.vue +306 -0
  37. package/src/patterns/McChat/McChatComment/McChatComment.vue +268 -0
  38. package/src/patterns/McChat/McChatForm/McChatForm.vue +150 -0
  39. package/src/patterns/McCollapse/McCollapse.vue +282 -0
  40. package/src/patterns/McDrawer/McDrawer.vue +150 -0
  41. package/src/patterns/McDropdown/McDropdown.vue +249 -0
  42. package/src/patterns/McDropdown/McDropdownPanel/McDropdownPanel.vue +44 -0
  43. package/src/patterns/McFakeScroll/McFakeScroll.vue +279 -0
  44. package/src/patterns/McFilter/McFilter.vue +847 -0
  45. package/src/patterns/McFilter/McFilterChip/McFilterChip.vue +85 -0
  46. package/src/patterns/McFilter/McFilterTags/McFilterTags.vue +376 -0
  47. package/src/patterns/McFilter/McFilterTypeDate/McFilterTypeDate.vue +70 -0
  48. package/src/patterns/McFilter/McFilterTypeRange/McFilterTypeRange.vue +133 -0
  49. package/src/patterns/McFilter/McFilterTypeRelation/McFilterTypeRelation.vue +224 -0
  50. package/src/patterns/McFilter/McFilterTypeSimple/McFilterTypeSimple.vue +164 -0
  51. package/src/patterns/McFilter/McFilterTypeText/McFilterTypeText.vue +62 -0
  52. package/src/patterns/McGrid/McGridCol/McGridCol.vue +166 -0
  53. package/src/patterns/McGrid/McGridRow/McGridRow.vue +158 -0
  54. package/src/patterns/McModal/McModal.vue +686 -0
  55. package/src/patterns/McOverlay/McOverlay.vue +79 -0
  56. package/src/patterns/McPreview/McPreview.vue +119 -0
  57. package/src/patterns/McSideBar/McSideBar/McSideBar.vue +389 -0
  58. package/src/patterns/McSideBar/McSideBarBottom/McSideBarBottom.vue +126 -0
  59. package/src/patterns/McSideBar/McSideBarButton/McSideBarButton.vue +257 -0
  60. package/src/patterns/McSideBar/McSideBarCenter/McSideBarCenter.vue +369 -0
  61. package/src/patterns/McSideBar/McSideBarTop/McSideBarTop.vue +243 -0
  62. package/src/patterns/McStack/McStack.vue +163 -0
  63. package/src/patterns/McTable/McTable/McTable.vue +860 -0
  64. package/src/patterns/McTable/McTableCol/McTableCol.vue +299 -0
  65. package/src/patterns/McTableCard/McTableCard.vue +138 -0
  66. package/src/patterns/McTableCard/McTableCardHeader/McTableCardHeader.vue +76 -0
  67. package/src/patterns/McTopBar/McTopBar.vue +155 -0
  68. package/src/patterns/McWrapScroll/McWrapScroll.vue +293 -0
  69. package/src/styles/_functions.scss +189 -0
  70. package/src/styles/_mixins.scss +619 -0
  71. package/src/styles/_spacing.scss +33 -0
  72. package/src/styles/_variables.scss +23 -0
  73. package/src/styles/global.scss +311 -0
  74. package/src/styles/main.scss +4 -0
  75. package/src/styles/table.scss +12 -0
  76. package/src/styles/toast.scss +59 -0
  77. package/src/templates/layouts/McContentFixed/McContentFixed.vue +60 -0
  78. package/src/templates/layouts/McMain/McMain.vue +115 -0
  79. package/src/templates/layouts/McRoot/McRoot.vue +45 -0
  80. package/src/tokens/animations.scss +9 -0
  81. package/src/tokens/border-radius.scss +26 -0
  82. package/src/tokens/box-shadows.scss +28 -0
  83. package/src/tokens/colors.scss +82 -0
  84. package/src/tokens/durations.scss +7 -0
  85. package/src/tokens/easings.scss +6 -0
  86. package/src/tokens/font-families.scss +8 -0
  87. package/src/tokens/font-sizes.scss +23 -0
  88. package/src/tokens/font-weights.scss +9 -0
  89. package/src/tokens/gradients.scss +19 -0
  90. package/src/tokens/letter-spacings.scss +6 -0
  91. package/src/tokens/line-heights.scss +22 -0
  92. package/src/tokens/media-queries.scss +32 -0
  93. package/src/tokens/opacities.scss +8 -0
  94. package/src/tokens/sizes.scss +47 -0
  95. package/src/tokens/spacings.scss +38 -0
  96. package/src/tokens/z-indexes.scss +14 -0
  97. package/src/utils/dayjs.js +19 -0
  98. package/src/utils/filters.js +11 -0
  99. package/src/utils/getTokens.js +41 -0
  100. package/src/utils/load-icons.js +3 -0
  101. package/src/utils/treeSearch.js +30 -0
  102. package/src/utils/webFontLoader.js +12 -0
  103. package/dist/0.mediacube-ui.umd.js +0 -50
  104. package/dist/assets/img/icons.3b7d59b2f49c67a2a3a4566b8ab233fd.svg +0 -1
  105. package/dist/assets/img/no_table_data.236cd56f46cfb71fc363b008d4ca70d5.png +0 -0
  106. package/dist/assets/img/no_user.e0030d6e54e2400e1181fd22b83cf8ae.png +0 -0
  107. package/dist/mediacube-ui.umd.js +0 -1
@@ -0,0 +1,243 @@
1
+ <template>
2
+ <div class="mc-side-bar-top" :class="`mc-side-bar-top--theme-${themeConfig.dropdownActivator}`">
3
+ <mc-preview v-if="!computedMenuApps" slot="activator">
4
+ <img
5
+ v-if="logoSrc"
6
+ slot="left"
7
+ class="mc-side-bar-top__img"
8
+ :src="logoSrc"
9
+ width="24"
10
+ height="24"
11
+ :alt="logoTitle"
12
+ />
13
+ <mc-title slot="top" weight="semi-bold" :variation="logoTitleVariation">
14
+ <template v-if="!compact">
15
+ {{ logoTitle }}
16
+ <slot slot="icon-append" name="title-append" />
17
+ </template>
18
+ </mc-title>
19
+ </mc-preview>
20
+ <mc-dropdown v-else v-model="dropIsOpen" :position="dropdownPosition">
21
+ <mc-preview slot="activator">
22
+ <img
23
+ v-if="logoSrc"
24
+ slot="left"
25
+ class="mc-side-bar-top__img"
26
+ :src="logoSrc"
27
+ width="24"
28
+ height="24"
29
+ :alt="logoTitle"
30
+ />
31
+ <mc-svg-icon v-else-if="logoIcon" slot="left" class="rotate" :name="logoIcon" />
32
+ <mc-button
33
+ slot="top"
34
+ :variation="`${themeConfig.dropdownActivator}-link`"
35
+ :size="compact ? 'l-compact' : 'l'"
36
+ class="mc-side-bar-top__activator-btn"
37
+ >
38
+ <mc-title v-if="!compact" weight="semi-bold" :variation="logoTitleVariation">
39
+ {{ logoTitle }}
40
+ <slot slot="icon-append" name="title-append" />
41
+ </mc-title>
42
+ <mc-svg-icon slot="icon-append" class="rotate" name="arrow_drop_down" color="gray" />
43
+ </mc-button>
44
+ </mc-preview>
45
+ <mc-dropdown-panel>
46
+ <mc-button
47
+ v-for="menuAppsItem in computedMenuApps"
48
+ :key="`menu-apps-item-${menuAppsItem.key}`"
49
+ full-width
50
+ text-align="left"
51
+ variation="black-flat"
52
+ :href="menuAppsItem.href"
53
+ :to="menuAppsItem.to"
54
+ :target="menuAppsItem.target"
55
+ :is-active="menuAppsItem.isActive"
56
+ :exact="menuAppsItem.exact"
57
+ >
58
+ <mc-svg-icon v-if="menuAppsItem.icon" slot="icon-prepend" :name="menuAppsItem.icon" />
59
+ <img
60
+ v-else-if="menuAppsItem.image"
61
+ slot="icon-prepend"
62
+ :src="menuAppsItem.image"
63
+ width="24"
64
+ height="24"
65
+ alt="service image"
66
+ />
67
+ {{ menuAppsItem.name }}
68
+ </mc-button>
69
+ </mc-dropdown-panel>
70
+ </mc-dropdown>
71
+ </div>
72
+ </template>
73
+
74
+ <script>
75
+ import _XEUtils from 'xe-utils'
76
+ import _isEmpty from 'lodash/isEmpty'
77
+ import McDropdown from '../../McDropdown/McDropdown'
78
+ import McDropdownPanel from '../../McDropdown/McDropdownPanel/McDropdownPanel'
79
+ import McButton from '../../../elements/McButton/McButton'
80
+ import McSvgIcon from '../../../elements/McSvgIcon/McSvgIcon'
81
+ import McPreview from '../../McPreview/McPreview'
82
+ import McTitle from '../../../elements/McTitle/McTitle'
83
+
84
+ export default {
85
+ name: 'McSideBarTop',
86
+ components: {
87
+ McDropdown,
88
+ McDropdownPanel,
89
+ McButton,
90
+ McPreview,
91
+ McSvgIcon,
92
+ McTitle,
93
+ },
94
+ inject: ['provideData'],
95
+ props: {
96
+ /**
97
+ * Меню приложений
98
+ *
99
+ */
100
+ menuApps: {
101
+ type: Array,
102
+ default: () => [],
103
+ },
104
+ /**
105
+ * Название сервиса
106
+ *
107
+ */
108
+ logoTitle: {
109
+ type: String,
110
+ default: 'Dashboard',
111
+ },
112
+ /**
113
+ * Размер текста названия сервиса
114
+ *
115
+ */
116
+ logoTitleVariation: {
117
+ type: String,
118
+ default: 'subtitle',
119
+ },
120
+ /**
121
+ * Путь до изображения
122
+ */
123
+ logoSrc: {
124
+ type: String,
125
+ default: '',
126
+ },
127
+ /**
128
+ * Имя иконки
129
+ * заголовка
130
+ */
131
+ logoIcon: {
132
+ type: String,
133
+ default: '',
134
+ },
135
+ dropdownPosition: {
136
+ type: String,
137
+ default: 'left',
138
+ },
139
+ /**
140
+ * Компактный вид
141
+ */
142
+ compact: {
143
+ type: Boolean,
144
+ default: false,
145
+ },
146
+ },
147
+ data() {
148
+ return {
149
+ dropIsOpen: false,
150
+ }
151
+ },
152
+ computed: {
153
+ themeConfig() {
154
+ return this.provideData
155
+ ? this.provideData.currentThemeConfig
156
+ : {
157
+ mode: 'black',
158
+ className: 'mc-side-bar--color-theme-black',
159
+ dropdownActivator: 'white',
160
+ mainMenuLinks: {
161
+ variable: 'gray-flat',
162
+ secondaryColor: 'white',
163
+ },
164
+ }
165
+ },
166
+ computedMenuApps() {
167
+ if (_isEmpty(this.menuApps)) return null
168
+ const apps = []
169
+ this.menuApps.forEach(app => {
170
+ if (app.isVisible) {
171
+ apps.push({
172
+ key: _XEUtils.uniqueId(),
173
+ ...app,
174
+ })
175
+ }
176
+ })
177
+ return apps
178
+ },
179
+ },
180
+ }
181
+ </script>
182
+
183
+ <style lang="scss">
184
+ @import '../../../styles/mixins';
185
+ @import '../../../tokens/colors';
186
+ @import '../../../tokens/spacings';
187
+ @import '../../../tokens/font-sizes';
188
+ @import '../../../tokens/line-heights';
189
+ @import '../../../tokens/sizes';
190
+ .mc-side-bar-top {
191
+ $block-name: &;
192
+ @include reset-text-indents();
193
+ position: sticky;
194
+ top: -($space-250);
195
+ padding: $space-250 $space-100;
196
+ background: $color-white;
197
+ margin: -($space-250) (-($space-100)) $space-150 !important;
198
+ z-index: 2;
199
+ .mc-dropdown__toggle {
200
+ &:hover {
201
+ cursor: pointer;
202
+ }
203
+ .mc-preview__left {
204
+ margin-inline-end: 0;
205
+ }
206
+ .mc-button {
207
+ line-height: $line-height-250;
208
+ &__text {
209
+ margin-inline-start: $space-100;
210
+ }
211
+ &__append {
212
+ margin-inline-start: 0;
213
+ }
214
+ .rotate {
215
+ @include size($size-200);
216
+ }
217
+ }
218
+ }
219
+ &__img {
220
+ margin-inline-start: $space-100;
221
+ }
222
+ &__activator-btn {
223
+ font-size: $font-size-400;
224
+ line-height: $line-height-300;
225
+ }
226
+ &--theme-white {
227
+ background: $color-black;
228
+ .mc-preview__top {
229
+ .mc-title {
230
+ color: $color-white;
231
+ }
232
+ }
233
+ }
234
+ &--theme-black {
235
+ background: $color-white;
236
+ .mc-preview__top {
237
+ .mc-title {
238
+ color: $color-black;
239
+ }
240
+ }
241
+ }
242
+ }
243
+ </style>
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <div ref="stack" class="mc-stack">
3
+ <div v-show="loaded" ref="mc-stack-body" class="mc-stack__body">
4
+ <slot />
5
+ </div>
6
+ <div v-if="more" ref="counter" class="mc-stack__counter">
7
+ {{ counterText }}
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: 'McStack',
15
+ /**
16
+ * Количество отрисованных
17
+ * единиц списка
18
+ * или число для макс. лимита
19
+ * или строка "auto" для расчета по доступной ширине
20
+ */
21
+ props: {
22
+ limit: {
23
+ type: [Number, String],
24
+ default: null,
25
+ },
26
+ collapsed: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ },
31
+ data: () => ({
32
+ children: null,
33
+ more: 0,
34
+ loaded: false,
35
+ custom_limit: 0,
36
+ }),
37
+ computed: {
38
+ classes() {
39
+ return {
40
+ 'mc-stack': true,
41
+ 'mc-stack--collapsed': this.collapsed,
42
+ }
43
+ },
44
+ isAutoLimit() {
45
+ return this.limit === 'auto'
46
+ },
47
+ counterText() {
48
+ return `+${this.more}`
49
+ },
50
+ },
51
+ mounted() {
52
+ this.init()
53
+ },
54
+ beforeDestroy() {
55
+ if (this.isAutoLimit) window.removeEventListener('resize', this.calcLimit)
56
+ },
57
+ methods: {
58
+ init() {
59
+ if (this.isAutoLimit) {
60
+ window.addEventListener('resize', this.calcLimit)
61
+ this.calcLimit()
62
+ // setTimeout из-за случаев, когда элемент рендерится с 0 шириной, а потом она устанавливается динамически
63
+ if (!this.$refs.stack?.clientWidth) {
64
+ setTimeout(() => this.calcLimit(), 1)
65
+ }
66
+ } else {
67
+ this.toggleChilds(true, this.limit)
68
+ }
69
+ },
70
+ calcLimit(showAll, limit) {
71
+ if (showAll) this.toggleChilds()
72
+ this.custom_limit = Infinity
73
+ let childWidth = 0
74
+ // ширина родителя без учета счетчика
75
+ const parentWidth = +this.$refs.stack?.clientWidth - (+this.$refs.counter?.clientWidth || 0)
76
+ for (let i = 0; i < this.children?.length; i++) {
77
+ const elemStyle = window.getComputedStyle(this.children[i])
78
+ childWidth += +this.children[i]?.clientWidth + +parseInt(elemStyle.marginRight)
79
+ // считаем занимаемую дочерними элементами ширину, если превышает родительскую, то выходим из цикла и ставим лимит
80
+ if (childWidth > parentWidth) {
81
+ this.custom_limit = i
82
+ break
83
+ }
84
+ }
85
+ // Сравниваем переданный лимит с заново выставленным, если они не равны, то ререндерим потомков
86
+ if (this.custom_limit !== limit) this.toggleChilds(true, this.custom_limit)
87
+ },
88
+ setStyles(elem, opacity = 1, visibility = 'visible', position = 'relative') {
89
+ elem.style.opacity = opacity
90
+ elem.style.visibility = visibility
91
+ elem.style.position = position
92
+ },
93
+ toggleChilds(hide, limit = 0) {
94
+ this.loaded = true
95
+ this.more = 0
96
+ this.children = this.$refs?.['mc-stack-body']?.children
97
+ let elementsLimit = hide ? limit - 1 : this.children.length
98
+ for (let i = 0; i < this.children?.length; i++) {
99
+ this.setStyles(this.children[i])
100
+ if (i > elementsLimit) {
101
+ this.setStyles(this.children[i], 0, 'hidden', 'absolute')
102
+ this.more++
103
+ }
104
+ }
105
+ // Передаем в $nextTick лимит для пересчета, т.к. рендерится counter, который занимает доп место и обрезает элементы
106
+ if (hide && this.isAutoLimit) this.$nextTick(() => this.calcLimit(false, limit))
107
+ },
108
+ },
109
+ }
110
+ </script>
111
+
112
+ <style lang="scss">
113
+ @import '../../styles/mixins';
114
+ @import '../../tokens/font-families';
115
+ @import '../../tokens/font-weights';
116
+ @import '../../tokens/font-sizes';
117
+ @import '../../tokens/line-heights';
118
+ @import '../../tokens/spacings';
119
+ @import '../../tokens/colors';
120
+ .mc-stack {
121
+ $block-name: &;
122
+
123
+ position: relative;
124
+ @include reset-text-indents();
125
+ display: flex;
126
+ align-items: center;
127
+ flex-wrap: nowrap;
128
+
129
+ &--collapsed {
130
+ #{$block-name}__body {
131
+ @include child-indent-right(-$space-200);
132
+ > * {
133
+ border: 2px solid $color-white;
134
+ }
135
+ }
136
+ }
137
+
138
+ &__body {
139
+ min-width: 0;
140
+ overflow: hidden;
141
+ display: flex;
142
+ flex-wrap: nowrap;
143
+ flex-direction: row;
144
+ @include child-indent-right($space-150);
145
+ > * {
146
+ justify-content: center;
147
+ }
148
+ }
149
+
150
+ &__counter {
151
+ width: auto;
152
+ position: sticky;
153
+ right: 0;
154
+ margin-inline-start: $space-50;
155
+ flex: 0 0 auto;
156
+ font-size: $font-size-200;
157
+ line-height: $line-height-200;
158
+ color: $color-gray;
159
+ font-weight: $font-weight-semi-bold;
160
+ font-family: $font-family-main;
161
+ }
162
+ }
163
+ </style>