mediacube-ui 0.1.207 → 0.1.209
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.209](https://github.com/MediaCubeCo/mcui/compare/v0.1.208...v0.1.209) (2024-01-16)
|
|
6
|
+
|
|
7
|
+
### [0.1.208](https://github.com/MediaCubeCo/mcui/compare/v0.1.207...v0.1.208) (2024-01-15)
|
|
8
|
+
|
|
5
9
|
### [0.1.207](https://github.com/MediaCubeCo/mcui/compare/v0.1.206...v0.1.207) (2024-01-12)
|
|
6
10
|
|
|
7
11
|
### [0.1.206](https://github.com/MediaCubeCo/mcui/compare/v0.1.205...v0.1.206) (2024-01-11)
|
package/package.json
CHANGED
|
@@ -323,6 +323,7 @@ export default {
|
|
|
323
323
|
searchValue: null,
|
|
324
324
|
key: `field_select_${Date.now()}`,
|
|
325
325
|
closest_scroll_element: null,
|
|
326
|
+
scroll_resize_observer: null,
|
|
326
327
|
}
|
|
327
328
|
},
|
|
328
329
|
computed: {
|
|
@@ -461,6 +462,8 @@ export default {
|
|
|
461
462
|
},
|
|
462
463
|
handleClose() {
|
|
463
464
|
this.closest_scroll_element?.removeEventListener('scroll', this.repositionDropDown)
|
|
465
|
+
this.scroll_resize_observer?.disconnect()
|
|
466
|
+
this.scroll_resize_observer = null
|
|
464
467
|
},
|
|
465
468
|
findClosestScrollElement(element) {
|
|
466
469
|
if (!element) return document.documentElement
|
|
@@ -474,6 +477,8 @@ export default {
|
|
|
474
477
|
// looking for closest scroll elemen to track select list position dynamically
|
|
475
478
|
this.closest_scroll_element = this.findClosestScrollElement(this.$refs.field)
|
|
476
479
|
this.closest_scroll_element.addEventListener('scroll', this.repositionDropDown)
|
|
480
|
+
this.scroll_resize_observer = new ResizeObserver(this.repositionDropDown)
|
|
481
|
+
this.scroll_resize_observer.observe(this.closest_scroll_element)
|
|
477
482
|
},
|
|
478
483
|
repositionDropDown() {
|
|
479
484
|
const { top, height, width, left } = this.$el.getBoundingClientRect()
|
|
@@ -491,9 +496,14 @@ export default {
|
|
|
491
496
|
ref.$refs.list.style.left = `${left}px`
|
|
492
497
|
const title_height = document.querySelector('.mc-field-select__header').offsetHeight
|
|
493
498
|
const title_margin = 8
|
|
494
|
-
|
|
499
|
+
let openDirection = this.openDirection
|
|
500
|
+
if (openDirection === 'auto') openDirection = ref?.isAbove ? 'top' : 'bottom'
|
|
501
|
+
switch (openDirection) {
|
|
495
502
|
case 'top':
|
|
496
|
-
ref.$refs.list.style.top = `${top +
|
|
503
|
+
ref.$refs.list.style.top = `${top +
|
|
504
|
+
(this.hasTitle ? title_height + title_margin : 0) -
|
|
505
|
+
ref.$refs.list.getBoundingClientRect().height -
|
|
506
|
+
8}px`
|
|
497
507
|
ref.$refs.list.style.bottom = 'auto'
|
|
498
508
|
break
|
|
499
509
|
case 'bottom':
|
|
@@ -746,6 +756,7 @@ export default {
|
|
|
746
756
|
border: none;
|
|
747
757
|
border-radius: $radius-150;
|
|
748
758
|
box-shadow: $shadow-s;
|
|
759
|
+
transition: opacity $duration-s ease;
|
|
749
760
|
overflow-y: auto;
|
|
750
761
|
overflow-x: hidden;
|
|
751
762
|
max-height: 300px;
|
|
@@ -138,15 +138,15 @@ export default {
|
|
|
138
138
|
button: {
|
|
139
139
|
regular: 600,
|
|
140
140
|
small: 500,
|
|
141
|
-
}
|
|
141
|
+
},
|
|
142
142
|
},
|
|
143
143
|
header: {
|
|
144
144
|
title: {
|
|
145
145
|
line_height: {
|
|
146
146
|
regular: 300,
|
|
147
147
|
small: 250,
|
|
148
|
-
}
|
|
149
|
-
}
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
150
|
},
|
|
151
151
|
}),
|
|
152
152
|
computed: {
|
|
@@ -235,22 +235,19 @@ export default {
|
|
|
235
235
|
},
|
|
236
236
|
|
|
237
237
|
calculateIndents() {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
/* Если шапка уже маленькая, то отключаем при отключении сепаратора
|
|
239
|
+
* Иначе смотрим, чтобы отступ был > чем убираемые отступы, т.к. нет смысла сжимать шапку, если <
|
|
240
|
+
*/
|
|
241
241
|
const indentDifferences =
|
|
242
|
-
(this.modal_params?.['--mc-modal-padding'] -
|
|
243
|
-
this.modal_params?.['--mc-modal-padding-small']) *
|
|
244
|
-
3
|
|
242
|
+
(this.modal_params?.['--mc-modal-padding'] - this.modal_params?.['--mc-modal-padding-small']) * 3
|
|
245
243
|
const lineHeightDifferences =
|
|
246
244
|
this.modal_params?.['--mc-modal-header-line-height'] -
|
|
247
245
|
this.modal_params?.['--mc-modal-header-line-height-small']
|
|
248
246
|
const buttonDifferences =
|
|
249
|
-
this.modal_params?.['--mc-modal-button-height'] -
|
|
250
|
-
this.modal_params?.['--mc-modal-button-height-small']
|
|
247
|
+
this.modal_params?.['--mc-modal-button-height'] - this.modal_params?.['--mc-modal-button-height-small']
|
|
251
248
|
const sizeDifferences = indentDifferences + lineHeightDifferences + buttonDifferences
|
|
252
249
|
if (!this.small_indents) {
|
|
253
|
-
const body =
|
|
250
|
+
const body = this.$refs.mcModalBody
|
|
254
251
|
this.can_shorten_modal = body?.scrollHeight - body?.clientHeight > sizeDifferences
|
|
255
252
|
}
|
|
256
253
|
},
|
|
@@ -275,7 +272,7 @@ export default {
|
|
|
275
272
|
// Сепаратор появится если высота скролла будет > 2px
|
|
276
273
|
const offset = 2
|
|
277
274
|
this.scrolled_top = scrollTop > offset
|
|
278
|
-
this.small_indents = this.scrolled_top
|
|
275
|
+
this.small_indents = this.scrolled_top && this.can_shorten_modal
|
|
279
276
|
this.scrolled_bottom = scrollTop + clientHeight < scrollHeight - offset
|
|
280
277
|
},
|
|
281
278
|
scrolled ? 0 : 300,
|
|
@@ -467,6 +464,10 @@ export default {
|
|
|
467
464
|
padding: $space-50 $space-400;
|
|
468
465
|
overflow: visible;
|
|
469
466
|
}
|
|
467
|
+
.mc-field-select {
|
|
468
|
+
position: relative;
|
|
469
|
+
z-index: 101;
|
|
470
|
+
}
|
|
470
471
|
}
|
|
471
472
|
&__inner {
|
|
472
473
|
box-shadow: 0 6px 12px rgba(110, 110, 110, 0.61);
|