mediacube-ui 0.1.301 → 0.1.303

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,10 @@
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.303](https://github.com/MediaCubeCo/mcui/compare/v0.1.302...v0.1.303) (2024-08-06)
6
+
7
+ ### [0.1.302](https://github.com/MediaCubeCo/mcui/compare/v0.1.301...v0.1.302) (2024-08-05)
8
+
5
9
  ### [0.1.301](https://github.com/MediaCubeCo/mcui/compare/v0.1.300...v0.1.301) (2024-08-01)
6
10
 
7
11
  ### [0.1.300](https://github.com/MediaCubeCo/mcui/compare/v0.1.299...v0.1.300) (2024-07-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui",
3
- "version": "0.1.301",
3
+ "version": "0.1.303",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -685,6 +685,14 @@ export default {
685
685
  }
686
686
  }
687
687
 
688
+ //Фикс Бага пакета, при клике на время сначала отрабатывает ховер с появлением скроллбара
689
+ //Из-за этого на айфоне требуется даблклик для выбора времени
690
+ .mx-scrollbar-track {
691
+ @media #{$media-mobile} {
692
+ opacity: 1 !important;
693
+ }
694
+ }
695
+
688
696
  .mx-input-wrapper:hover .mx-icon-clear + .mx-icon-calendar {
689
697
  display: block;
690
698
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div ref="field" :dir="dir" :class="classes" :style="styles">
2
+ <div :ref="field_key" :dir="dir" :class="classes" :style="styles">
3
3
  <div :for="name" class="mc-field-select__header">
4
4
  <!-- @slot Слот заголовка -->
5
5
  <slot name="header">
@@ -335,6 +335,7 @@ export default {
335
335
  return {
336
336
  searchValue: null,
337
337
  key: `field_select_${Date.now()}`,
338
+ field_key: `field-${this.name}`,
338
339
  closest_scroll_element: null,
339
340
  scroll_resize_observer: null,
340
341
  local_options: [],
@@ -508,7 +509,6 @@ export default {
508
509
  },
509
510
  handleOpen() {
510
511
  if (!this.renderAbsoluteList) return
511
- this.repositionDropDown()
512
512
  this.initScroll()
513
513
  },
514
514
  handleClose() {
@@ -526,24 +526,22 @@ export default {
526
526
  },
527
527
  initScroll() {
528
528
  // looking for closest scroll elemen to track select list position dynamically
529
- this.closest_scroll_element = this.findClosestScrollElement(this.$refs.field)
529
+ this.closest_scroll_element = this.findClosestScrollElement(this.$refs[this.field_key])
530
530
  this.closest_scroll_element.addEventListener('scroll', this.repositionDropDown)
531
531
  this.scroll_resize_observer = new ResizeObserver(this.repositionDropDown)
532
532
  this.scroll_resize_observer.observe(this.closest_scroll_element)
533
533
  },
534
534
  repositionDropDown() {
535
- const { top, height, width, left } = this.$el.getBoundingClientRect()
535
+ const { top, bottom, height, width, left } = this.$el.getBoundingClientRect()
536
536
  const ref = this.$refs[this.key]
537
+ const ios_devices = ['iPhone', 'iPad']
537
538
  // Добавляем к позиции отступ visualViewport?.offsetTop, который добавляет iOs при открытии вирутальной клавиатуры
538
- const iosViewportIndent = window.visualViewport?.offsetTop || 0
539
+ const iosViewportIndent = ios_devices?.some(device => navigator?.platform?.includes(device)) ? window.visualViewport?.offsetTop || 0 : 0
539
540
  // if field hides under scrolled element borders -> blur select to prevent overlap
540
541
  const scrolledHeight = this.closest_scroll_element?.scrollTop
541
- const fieldHeght = this.$refs.field.clientHeight
542
- const scrolledElementTop = this.closest_scroll_element?.getBoundingClientRect().top
543
-
544
- if (scrolledHeight - fieldHeght - scrolledElementTop - top - iosViewportIndent > 0) return ref.deactivate()
545
-
546
- if (ref) {
542
+ const fieldHeght = this.$refs[this.field_key]?.clientHeight || 0
543
+ const scrolledElementTop = this.closest_scroll_element?.getBoundingClientRect().top
544
+ if (ref && top >= -height && bottom <= (window.innerHeight || document.documentElement.clientHeight)) {
547
545
  ref.$refs.list.style.width = `${width}px`
548
546
  ref.$refs.list.style.position = 'fixed'
549
547
  ref.$refs.list.style.left = `${left}px`
@@ -566,6 +564,10 @@ export default {
566
564
  break
567
565
  }
568
566
  }
567
+ else {
568
+ // прячем селект, если его не видно юзеру
569
+ return ref.deactivate()
570
+ }
569
571
  },
570
572
  handleChange(value) {
571
573
  /**
@@ -672,14 +674,6 @@ export default {
672
674
  }
673
675
  }
674
676
 
675
- //Фикс Бага пакета, при клике на время сначала отрабатывает ховер с появлением скроллбара
676
- //Из-за этого на айфоне требуется даблклик для выбора времени
677
- .mx-scrollbar-track {
678
- @media #{$media-mobile} {
679
- opacity: 1 !important;
680
- }
681
- }
682
-
683
677
  .multiselect {
684
678
  &__placeholder {
685
679
  @include ellipsis();