mediacube-ui 0.1.412 → 0.1.413

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.413](https://github.com/MediaCubeCo/mcui/compare/v0.1.412...v0.1.413) (2025-09-17)
6
+
5
7
  ### [0.1.412](https://github.com/MediaCubeCo/mcui/compare/v0.1.411...v0.1.412) (2025-09-17)
6
8
 
7
9
  ### [0.1.411](https://github.com/MediaCubeCo/mcui/compare/v0.1.410...v0.1.411) (2025-09-17)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui",
3
- "version": "0.1.412",
3
+ "version": "0.1.413",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -28,7 +28,7 @@
28
28
  </template>
29
29
  <template slot="singleLabel" slot-scope="{ option }">
30
30
  <mc-preview v-if="optionWithPreview" class="option__desc" size="l">
31
- <template v-if="option.icon || option.image" #left>
31
+ <template v-if="option?.icon || option?.image" #left>
32
32
  <mc-avatar v-if="option.image" :src="option.image" size="400" />
33
33
  <mc-svg-icon v-else :name="option.icon" :color="option.iconColor || 'main'" size="400" />
34
34
  </template>
@@ -77,7 +77,7 @@
77
77
  {{ option.$groupLabel }}
78
78
  </mc-title>
79
79
  <mc-preview v-else-if="optionWithPreview || optionWithPreviewOnly" class="option__desc" size="l">
80
- <template v-if="option.icon || option.image" #left>
80
+ <template v-if="option?.icon || option?.image" #left>
81
81
  <mc-avatar v-if="option.image" :src="option.image" size="400" />
82
82
  <mc-svg-icon v-else :name="option.icon" :color="option.iconColor || 'main'" size="400" />
83
83
  </template>
@@ -419,7 +419,7 @@ export default {
419
419
  tabindex: +this.tabindex,
420
420
  ...(this.groupKeys ? { groupLabel: this.groupKeys.label } : {}),
421
421
  ...(this.groupKeys ? { groupValues: this.groupKeys.values } : {}),
422
- ...(this.collapsed ? { limit: this.is_show_all_options ? this.value.length : this.custom_limit } : {}),
422
+ ...(this.collapsed ? { limit: this.is_show_all_options ? this.value?.length : this.custom_limit } : {}),
423
423
  class: this.collapsed ? 'mc-field-select__limit' : '',
424
424
  }
425
425
  },
@@ -434,10 +434,10 @@ export default {
434
434
  }
435
435
  },
436
436
  limitText() {
437
- return `+${+this.value.length - +this.custom_limit}`
437
+ return `+${+this.value?.length - +this.custom_limit}`
438
438
  },
439
439
  isShowLimitToggle() {
440
- return this.collapsed && this.value.length > this.custom_limit
440
+ return this.collapsed && this.value?.length > this.custom_limit
441
441
  },
442
442
  hasTitle() {
443
443
  return !!this.title
@@ -492,7 +492,7 @@ export default {
492
492
  options.push(...option[this.groupKeys.values])
493
493
  }
494
494
  }
495
- return this.isEmptyOptionsList || this.loading || options.length === this._value.length
495
+ return this.isEmptyOptionsList || this.loading || options?.length === this._value?.length
496
496
  },
497
497
  computedTitle() {
498
498
  return `${this.title}${this.required ? ' *' : ''}`
@@ -534,7 +534,7 @@ export default {
534
534
  : this.computedOptions),
535
535
  ]
536
536
  let option = options.find(o => {
537
- if (o.value.hasOwnProperty('id') && o.value.id == value.id) {
537
+ if (o.value?.hasOwnProperty('id') && o.value.id == value.id) {
538
538
  return true
539
539
  }
540
540
  return o.value == value
@@ -591,7 +591,7 @@ export default {
591
591
  actualizeSavedOptions() {
592
592
  //Фильтруем локальные опции и оставляем только те, значения которых выбраны в селекте
593
593
  this.local_options = this.local_options.filter(lo =>
594
- this.value.constructor === Array
594
+ this.value?.constructor === Array
595
595
  ? this.value.map(v => String(v)).includes(String(lo.value))
596
596
  : String(lo.value) === String(this.value),
597
597
  )
@@ -612,8 +612,8 @@ export default {
612
612
  this.initScroll()
613
613
  },
614
614
  handleClose() {
615
- this.closest_scroll_element.removeEventListener('scroll', this.repositionDropDown)
616
- this.scroll_resize_observer.disconnect()
615
+ this.closest_scroll_element?.removeEventListener('scroll', this.repositionDropDown)
616
+ this.scroll_resize_observer?.disconnect()
617
617
  this.scroll_resize_observer = null
618
618
  },
619
619
  findClosestScrollElement(element) {
@@ -637,9 +637,9 @@ export default {
637
637
  const ref = this.$refs[this.key]
638
638
  if (!ref) return
639
639
  const ios_devices = ['iPhone', 'iPad']
640
- // Добавляем к позиции отступ visualViewport.offsetTop, который добавляет iOs при открытии вирутальной клавиатуры
641
- const iosViewportIndent = ios_devices.some(device => navigator.platform.includes(device))
642
- ? window.visualViewport.offsetTop || 0
640
+ // Добавляем к позиции отступ visualViewport?.offsetTop, который добавляет iOs при открытии вирутальной клавиатуры
641
+ const iosViewportIndent = ios_devices?.some(device => navigator?.platform?.includes(device))
642
+ ? window.visualViewport?.offsetTop || 0
643
643
  : 0
644
644
  // Высчитываем реальную позицию селекта относительно первого скроллящегося родителя
645
645
  const actualTop = top - scrollElementRect.top
@@ -652,7 +652,7 @@ export default {
652
652
  const title_height = document.querySelector('.mc-field-select__header').offsetHeight
653
653
  const title_margin = 8
654
654
  let openDirection = this.openDirection
655
- if (openDirection === 'auto') openDirection = ref.isAbove ? 'top' : 'bottom'
655
+ if (openDirection === 'auto') openDirection = ref?.isAbove ? 'top' : 'bottom'
656
656
  switch (openDirection) {
657
657
  case 'top':
658
658
  ref.$refs.list.style.top = `${top +
@@ -724,14 +724,14 @@ export default {
724
724
  this.$nextTick(() => {
725
725
  this.custom_limit = Infinity
726
726
  let child_width = 0
727
- const parent = this.$refs[this.key].$refs.tags.firstChild
728
- if (!this.value.length) return
727
+ const parent = this.$refs[this.key]?.$refs?.tags?.firstChild
728
+ if (!this.value?.length) return
729
729
  const limit_text_width = this.getLimitTextWidth() // Получаем ширину текста лимита
730
- const total_width = +parent.clientWidth - +limit_text_width
731
- for (let i = 0; i < this.value.length; i++) {
732
- const children = parent.children[i]
730
+ const total_width = +parent?.clientWidth - +limit_text_width
731
+ for (let i = 0; i < this.value?.length; i++) {
732
+ const children = parent?.children?.[i]
733
733
  const elem_style = window.getComputedStyle(children)
734
- child_width += children.clientWidth + (parseInt(elem_style.marginRight) || 0)
734
+ child_width += children?.clientWidth + (parseInt(elem_style?.marginRight) || 0)
735
735
  // считаем занимаемую дочерними элементами ширину, если превышает родительскую, то выходим из цикла и ставим лимит
736
736
  if (+child_width > +total_width) {
737
737
  this.custom_limit = i
@@ -744,7 +744,7 @@ export default {
744
744
  const temp_limit_element = document.createElement('div')
745
745
  temp_limit_element.style.visibility = 'hidden'
746
746
  temp_limit_element.style.position = 'absolute'
747
- temp_limit_element.innerText = `+${this.value.length}` // Устанавливаем текст лимита
747
+ temp_limit_element.innerText = `+${this.value?.length}` // Устанавливаем текст лимита
748
748
  document.body.appendChild(temp_limit_element)
749
749
  const limit_text_width = temp_limit_element.clientWidth
750
750
  document.body.removeChild(temp_limit_element)