mediacube-ui 0.1.354 → 0.1.355

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.355](https://github.com/MediaCubeCo/mcui/compare/v0.1.354...v0.1.355) (2025-01-16)
6
+
5
7
  ### [0.1.354](https://github.com/MediaCubeCo/mcui/compare/v0.1.353...v0.1.354) (2025-01-15)
6
8
 
7
9
  ### [0.1.353](https://github.com/MediaCubeCo/mcui/compare/v0.1.352...v0.1.353) (2025-01-14)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui",
3
- "version": "0.1.354",
3
+ "version": "0.1.355",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -65,6 +65,7 @@
65
65
  <template v-else>
66
66
  <mc-button
67
67
  v-if="placeholders.week"
68
+ :disabled="checkDisablePeriod('week')"
68
69
  variation="black-link"
69
70
  secondary-color="main"
70
71
  @click="selectPeriod('week')"
@@ -73,6 +74,7 @@
73
74
  </mc-button>
74
75
  <mc-button
75
76
  v-if="placeholders.month"
77
+ :disabled="checkDisablePeriod('month')"
76
78
  variation="black-link"
77
79
  secondary-color="main"
78
80
  @click="selectPeriod('month')"
@@ -81,6 +83,7 @@
81
83
  </mc-button>
82
84
  <mc-button
83
85
  v-if="placeholders.quarter"
86
+ :disabled="checkDisablePeriod('quarter')"
84
87
  variation="black-link"
85
88
  secondary-color="main"
86
89
  @click="selectPeriod('quarter')"
@@ -89,6 +92,7 @@
89
92
  </mc-button>
90
93
  <mc-button
91
94
  v-if="placeholders.year"
95
+ :disabled="checkDisablePeriod('year')"
92
96
  variation="black-link"
93
97
  secondary-color="main"
94
98
  @click="selectPeriod('year')"
@@ -503,7 +507,14 @@ export default {
503
507
  }
504
508
  }
505
509
  },
506
- selectPeriod(key) {
510
+ /**
511
+ * Проверяем доступность выбора периода по досупной дате, если есть ограничения
512
+ * */
513
+ checkDisablePeriod(period) {
514
+ const [start] = this.selectPeriod(period)
515
+ return this.disabledDate(start)
516
+ },
517
+ selectPeriod(key, isReturn = false) {
507
518
  let start = new Date()
508
519
  const end = this.pickDate || new Date()
509
520
  switch (key) {
@@ -536,7 +547,9 @@ export default {
536
547
  start.setFullYear(end.getFullYear() - 1, end.getMonth(), end.getDate())
537
548
  break
538
549
  }
539
- this.$refs.input.currentValue = [dayjs ? start.toDate() : start, end]
550
+ const period = [dayjs ? start.toDate() : start, end]
551
+ if (isReturn) return period
552
+ this.$refs.input.currentValue = period
540
553
  },
541
554
  handlerPreselectRange(period) {
542
555
  const [start, end] = period
@@ -717,12 +730,25 @@ export default {
717
730
  left: $space-200 !important;
718
731
  right: $space-200;
719
732
  width: fit-content;
733
+ .mx-range-wrapper {
734
+ max-height: 80vh;
735
+ overflow-y: auto;
736
+ }
737
+ .mx-datepicker-footer {
738
+ position: sticky;
739
+ bottom: 0;
740
+ background-color: $color-white;
741
+ }
720
742
  }
721
743
 
722
744
  .mx-calendar + .mx-calendar {
723
745
  border-left: none;
724
746
  }
725
747
 
748
+ .mx-range-wrapper {
749
+ align-items: center;
750
+ }
751
+
726
752
  .mx-calendar {
727
753
  width: 256px;
728
754
  padding: $space-200;
@@ -794,6 +820,14 @@ export default {
794
820
  > * {
795
821
  @include child-indent-right($space-300);
796
822
  }
823
+ &-periods {
824
+ @include child-indent-right(0);
825
+ column-gap: $space-300;
826
+ row-gap: $space-100;
827
+ align-items: center;
828
+ display: flex;
829
+ flex-wrap: wrap;
830
+ }
797
831
  .mc-button {
798
832
  @include child-indent-right($space-zero);
799
833
  }
@@ -27,7 +27,7 @@
27
27
  <slot />
28
28
  </div>
29
29
  <!-- @slot Слот футера -->
30
- <div class="mc-modal__control"><slot name="footer" /><portal-target name="mcModalFooter" slim /></div>
30
+ <div ref="mcModalFooter" class="mc-modal__control"><slot name="footer" /><portal-target name="mcModalFooter" slim /></div>
31
31
  </div>
32
32
  <button v-if="arrowVisible" type="button" class="mc-modal__btn-back" @click.prevent="handleBack">
33
33
  <mc-svg-icon name="arrow_leftward" class="mc-modal__icon-back" />
@@ -133,6 +133,7 @@ export default {
133
133
  indent: {
134
134
  regular: 400,
135
135
  small: 150,
136
+ extra_small: 50,
136
137
  },
137
138
  footer: {
138
139
  button: {
@@ -168,6 +169,7 @@ export default {
168
169
  return {
169
170
  '--mc-modal-padding': `var(--space-${this.indent.regular})`,
170
171
  '--mc-modal-padding-small': `var(--space-${this.indent.small})`,
172
+ '--mc-modal-padding-extra-small': `var(--space-${this.indent.extra_small})`,
171
173
  '--mc-modal-header-line-height': `var(--line-height-${this.header.title.line_height.regular})`,
172
174
  '--mc-modal-header-line-height-small': `var(--line-height-${this.header.title.line_height.small})`,
173
175
  '--mc-modal-button-height': `var(--size-${this.footer.button.regular})`,
@@ -236,19 +238,32 @@ export default {
236
238
  },
237
239
 
238
240
  calculateIndents() {
239
- /* Если шапка уже маленькая, то отключаем при отключении сепаратора
240
- * Иначе смотрим, чтобы отступ был > чем убираемые отступы, т.к. нет смысла сжимать шапку, если <
241
- */
242
- const indentDifferences =
243
- (this.modal_params?.['--mc-modal-padding'] - this.modal_params?.['--mc-modal-padding-small']) * 3 +
244
- this.modal_params?.['--mc-modal-padding-small']
245
- const lineHeightDifferences =
246
- this.modal_params?.['--mc-modal-header-line-height'] -
247
- this.modal_params?.['--mc-modal-header-line-height-small']
248
- const buttonDifferences =
249
- this.modal_params?.['--mc-modal-button-height'] - this.modal_params?.['--mc-modal-button-height-small']
250
- const sizeDifferences = indentDifferences + lineHeightDifferences + buttonDifferences
251
241
  if (!this.small_indents) {
242
+ /* Если шапка уже маленькая, то отключаем при отключении сепаратора
243
+ * Иначе смотрим, чтобы отступ был > чем убираемые отступы, т.к. нет смысла сжимать шапку, если <
244
+ * 1,2 - отступы в шапке уменьшаются с 32 до 12 сверху и снизу
245
+ * 3 - отступы в футере: нижний уменьшается с 32 до 12
246
+ * 4 - отступ в футере верхний уменьшается с 16 до 12
247
+ * 5 - отступ в боди уменьшается с 16 до 4
248
+ * итого (32 - 12) * 3 + 12 + 4 - тотал уменьшения отступов
249
+ * если футер пустой, то умножаем на 2
250
+ */
251
+ const totalBtns = this.$refs.mcModalFooter?.querySelectorAll('.mc-button')?.length
252
+ const smallerElementsAmount = totalBtns ? 3 : 2
253
+ const indentDifferences =
254
+ (this.modal_params?.['--mc-modal-padding'] - this.modal_params?.['--mc-modal-padding-small']) *
255
+ smallerElementsAmount +
256
+ (this.modal_params?.['--mc-modal-padding-small'] +
257
+ this.modal_params?.['--mc-modal-padding-extra-small'])
258
+ const lineHeightDifferences =
259
+ this.modal_params?.['--mc-modal-header-line-height'] -
260
+ this.modal_params?.['--mc-modal-header-line-height-small']
261
+ const buttonDifferences =
262
+ this.modal_params?.['--mc-modal-button-height'] -
263
+ this.modal_params?.['--mc-modal-button-height-small']
264
+ // Смотрим разницу размеров с учетом кол-ва кнопок в модалке + добавляем за каждую кнопку 1px погрешности для отображения бордера
265
+ const sizeDifferences =
266
+ indentDifferences + lineHeightDifferences + buttonDifferences * totalBtns + totalBtns
252
267
  const body = this.$refs.mcModalBody
253
268
  this.can_shorten_modal = body?.scrollHeight - body?.clientHeight > sizeDifferences
254
269
  }