@eturnity/eturnity_reusable_components 7.51.16-EPDM-12459.0 → 7.51.16-EPDM-13312.0
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -139,13 +139,10 @@
|
|
139
139
|
<SelectDropdown
|
140
140
|
v-show="isSelectDropdownShown"
|
141
141
|
ref="dropdown"
|
142
|
-
:style="{
|
143
|
-
transform: `translate(${dropdownPosition?.left}px, ${
|
144
|
-
noRelative ? 'auto' : `${dropdownPosition?.top}px`
|
145
|
-
})`,
|
146
|
-
}"
|
147
142
|
:bg-color="
|
148
|
-
|
143
|
+
dropdownBgColor ||
|
144
|
+
colorMode == 'dark' ||
|
145
|
+
colorMode == 'transparent'
|
149
146
|
? 'black'
|
150
147
|
: 'white'
|
151
148
|
"
|
@@ -398,8 +395,9 @@
|
|
398
395
|
box-sizing: border-box;
|
399
396
|
z-index: ${(props) => (props.isActive ? '2' : '99999')};
|
400
397
|
position: absolute;
|
401
|
-
top:
|
402
|
-
|
398
|
+
top: ${(props) =>
|
399
|
+
props.noRelative ? 'auto' : props.dropdownPosition?.top + 'px'};
|
400
|
+
left: ${(props) => props.dropdownPosition?.left}px;
|
403
401
|
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
404
402
|
border-radius: 4px;
|
405
403
|
display: flex;
|
@@ -660,10 +658,6 @@
|
|
660
658
|
},
|
661
659
|
dropdownWidth: null,
|
662
660
|
hoveredValue: null,
|
663
|
-
isDisplayedAtBottom: true,
|
664
|
-
selectTopPosition: 0,
|
665
|
-
selectAndDropdownDistance: 0,
|
666
|
-
animationFrameId: null,
|
667
661
|
}
|
668
662
|
},
|
669
663
|
computed: {
|
@@ -734,13 +728,8 @@
|
|
734
728
|
}, 10)
|
735
729
|
await this.$nextTick()
|
736
730
|
this.handleSetDropdownOffet()
|
737
|
-
this.calculateSelectTopPosition()
|
738
731
|
} else {
|
739
732
|
this.dropdownPosition.left = null
|
740
|
-
if (this.animationFrameId) {
|
741
|
-
cancelAnimationFrame(this.animationFrameId)
|
742
|
-
this.animationFrameId = null
|
743
|
-
}
|
744
733
|
setTimeout(() => {
|
745
734
|
this.isClickOutsideActive = false
|
746
735
|
}, 10)
|
@@ -753,27 +742,11 @@
|
|
753
742
|
})
|
754
743
|
}
|
755
744
|
},
|
756
|
-
isSelectDropdownShown(isShown) {
|
757
|
-
if (!isShown) return
|
758
|
-
|
759
|
-
// Need to wait for 1ms to make sure the dropdown menu is shown in the DOM
|
760
|
-
// before getting the distance between the select and the dropdown menu
|
761
|
-
setTimeout(() => {
|
762
|
-
this.getDistanceBetweenSelectAndDropdownMenu()
|
763
|
-
}, 100)
|
764
|
-
},
|
765
|
-
selectTopPosition() {
|
766
|
-
this.dropdownPosition.top =
|
767
|
-
this.selectTopPosition +
|
768
|
-
this.$refs.select.$el.clientHeight +
|
769
|
-
this.selectAndDropdownDistance
|
770
|
-
},
|
771
745
|
},
|
772
746
|
mounted() {
|
773
747
|
this.observeDropdownHeight()
|
774
748
|
this.observeSelectWidth()
|
775
749
|
window.addEventListener('resize', this.handleSetDropdownOffet)
|
776
|
-
document.body.addEventListener('scroll', this.calculateSelectTopPosition)
|
777
750
|
},
|
778
751
|
beforeMount() {
|
779
752
|
this.selectedValue = this.value
|
@@ -782,10 +755,6 @@
|
|
782
755
|
window.removeEventListener('resize', this.handleSetDropdownOffet)
|
783
756
|
if (this.dropdownResizeObserver) this.dropdownResizeObserver.disconnect()
|
784
757
|
if (this.selectResizeObserver) this.selectResizeObserver.disconnect()
|
785
|
-
document.body.removeEventListener(
|
786
|
-
'scroll',
|
787
|
-
this.calculateSelectTopPosition
|
788
|
-
)
|
789
758
|
},
|
790
759
|
unmounted() {
|
791
760
|
document.removeEventListener('click', this.clickOutside)
|
@@ -891,11 +860,11 @@
|
|
891
860
|
return
|
892
861
|
}
|
893
862
|
await this.$nextTick()
|
894
|
-
|
863
|
+
const isDisplayedAtBottom = await this.generateDropdownPosition()
|
895
864
|
// If the dropdown menu is going to be displayed at the bottom,
|
896
865
|
// we need reverify its position after a dom update (nextTick)
|
897
866
|
await this.$nextTick()
|
898
|
-
if (
|
867
|
+
if (isDisplayedAtBottom) this.generateDropdownPosition()
|
899
868
|
},
|
900
869
|
async generateDropdownPosition() {
|
901
870
|
const isDropdownNotCompletelyVisible =
|
@@ -988,25 +957,6 @@
|
|
988
957
|
}
|
989
958
|
}
|
990
959
|
},
|
991
|
-
getDistanceBetweenSelectAndDropdownMenu() {
|
992
|
-
const wholeSelectTopPosition =
|
993
|
-
this.selectTopPosition + this.$refs.select.$el.clientHeight
|
994
|
-
this.selectAndDropdownDistance =
|
995
|
-
this.dropdownPosition.top - wholeSelectTopPosition
|
996
|
-
},
|
997
|
-
calculateSelectTopPosition() {
|
998
|
-
const selectRef = this.$refs.select
|
999
|
-
if (selectRef) {
|
1000
|
-
const currentTopPosition =
|
1001
|
-
selectRef.$el.getBoundingClientRect().top + window.scrollY
|
1002
|
-
if (this.selectTopPosition !== currentTopPosition) {
|
1003
|
-
this.selectTopPosition = currentTopPosition
|
1004
|
-
}
|
1005
|
-
}
|
1006
|
-
this.animationFrameId = requestAnimationFrame(
|
1007
|
-
this.calculateSelectTopPosition
|
1008
|
-
)
|
1009
|
-
},
|
1010
960
|
},
|
1011
961
|
}
|
1012
962
|
</script>
|
@@ -30,6 +30,9 @@
|
|
30
30
|
<IconPlaceholder v-else />
|
31
31
|
</IconWrapper>
|
32
32
|
<TextContainer
|
33
|
+
:is-archived="
|
34
|
+
item.statusActive === false && !!item.companyComponentLibraryId
|
35
|
+
"
|
33
36
|
:style="{ marginLeft: item.type == 'optimizer' ? '32px' : '0' }"
|
34
37
|
>
|
35
38
|
<TitleText :title="item.model">
|
@@ -40,6 +43,20 @@
|
|
40
43
|
: ''
|
41
44
|
}}
|
42
45
|
{{ item.model }}
|
46
|
+
<InfoTextWrapper>
|
47
|
+
<RCInfoText
|
48
|
+
v-if="
|
49
|
+
item.statusActive === false &&
|
50
|
+
item.companyComponentLibraryId
|
51
|
+
"
|
52
|
+
button-type="error"
|
53
|
+
:text="
|
54
|
+
$gettext(
|
55
|
+
`Component has been archived and shouldn't be used`
|
56
|
+
)
|
57
|
+
"
|
58
|
+
/>
|
59
|
+
</InfoTextWrapper>
|
43
60
|
</TitleText>
|
44
61
|
<TitleSubText>
|
45
62
|
<span>{{ item.brandName }}</span>
|
@@ -417,7 +434,7 @@
|
|
417
434
|
import RCIcon from '../../icon'
|
418
435
|
import ButtonIcon from '../../buttons/buttonIcon'
|
419
436
|
import { numberToString } from '../../../helpers/numberConverter'
|
420
|
-
|
437
|
+
import RCInfoText from '../../infoText'
|
421
438
|
const PageContainer = styled.div`
|
422
439
|
position: relative;
|
423
440
|
`
|
@@ -444,16 +461,23 @@
|
|
444
461
|
margin-left: 32px;
|
445
462
|
margin-top: 4px;
|
446
463
|
`
|
447
|
-
|
448
|
-
const TextContainer = styled
|
464
|
+
const textContainerAttr = { isArchived: Boolean }
|
465
|
+
const TextContainer = styled('div', textContainerAttr)`
|
449
466
|
display: grid;
|
467
|
+
color: ${(props) => (props.isArchived ? props.theme.colors.red : 'white')};
|
468
|
+
`
|
469
|
+
const InfoTextWrapper = styled.div`
|
470
|
+
display: flex;
|
471
|
+
align-items: center;
|
472
|
+
justify-content: center;
|
473
|
+
padding-left: 8px;
|
450
474
|
`
|
451
|
-
|
452
475
|
const TitleText = styled.div`
|
453
476
|
font-size: 14px;
|
454
477
|
white-space: nowrap;
|
455
478
|
overflow: hidden;
|
456
479
|
text-overflow: ellipsis;
|
480
|
+
display: flex;
|
457
481
|
`
|
458
482
|
|
459
483
|
const TitleSubText = styled.div`
|
@@ -708,6 +732,8 @@
|
|
708
732
|
export default {
|
709
733
|
name: 'DropdownMenu',
|
710
734
|
components: {
|
735
|
+
InfoTextWrapper,
|
736
|
+
RCInfoText,
|
711
737
|
SectionContainer,
|
712
738
|
TitleContainer,
|
713
739
|
IconsContainer,
|