@eturnity/eturnity_reusable_components 7.12.6-EPDM-7951.4 → 7.12.6-EPDM-7951.6
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/package.json
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
<template>
|
2
|
-
<wrapper
|
3
|
-
<icon-image
|
4
|
-
<i v-html="
|
2
|
+
<wrapper>
|
3
|
+
<icon-image>
|
4
|
+
<i v-html="icon.html" />
|
5
5
|
</icon-image>
|
6
|
-
<striked-line
|
7
|
-
v-if="isStriked"
|
8
|
-
:color="color"
|
9
|
-
:disabled="disabled"
|
10
|
-
:hoveredColor="hoveredColor"
|
11
|
-
></striked-line>
|
6
|
+
<striked-line v-if="isStriked"></striked-line>
|
12
7
|
</wrapper>
|
13
8
|
</template>
|
14
9
|
|
@@ -26,17 +21,45 @@
|
|
26
21
|
|
27
22
|
import { onMounted, reactive, watch } from 'vue'
|
28
23
|
import styled from 'vue3-styled-components'
|
29
|
-
|
30
|
-
const
|
24
|
+
|
25
|
+
const props = defineProps({
|
26
|
+
disabled: {
|
27
|
+
required: false,
|
28
|
+
default: false
|
29
|
+
},
|
30
|
+
name: {
|
31
|
+
required: true
|
32
|
+
},
|
33
|
+
color: {
|
34
|
+
required: false
|
35
|
+
},
|
36
|
+
hoveredColor: {
|
37
|
+
required: false
|
38
|
+
},
|
39
|
+
size: {
|
40
|
+
required: false,
|
41
|
+
default: '30px'
|
42
|
+
},
|
43
|
+
cursor: {
|
44
|
+
required: false,
|
45
|
+
default: null
|
46
|
+
},
|
47
|
+
isStriked: {
|
48
|
+
required: false,
|
49
|
+
default: false
|
50
|
+
}
|
51
|
+
})
|
52
|
+
|
53
|
+
const Wrapper = styled('div')`
|
31
54
|
display: flex;
|
32
55
|
position: relative;
|
33
56
|
align-content: center;
|
34
57
|
justify-content: center;
|
35
|
-
width: ${
|
36
|
-
height: ${
|
37
|
-
min-width: ${
|
38
|
-
min-height: ${
|
39
|
-
cursor: ${
|
58
|
+
width: ${props.size};
|
59
|
+
height: ${props.size};
|
60
|
+
min-width: ${props.size};
|
61
|
+
min-height: ${props.size};
|
62
|
+
cursor: ${props.disabled ? 'not-allowed' : props.cursor};
|
40
63
|
line-height: 0;
|
41
64
|
`
|
42
65
|
const strikedAttrs = {
|
@@ -44,7 +67,7 @@ const strikedAttrs = {
|
|
44
67
|
color: String,
|
45
68
|
hoveredColor: String
|
46
69
|
}
|
47
|
-
const StrikedLine = styled
|
70
|
+
const StrikedLine = styled.div`
|
48
71
|
display: flex;
|
49
72
|
position: absolute;
|
50
73
|
bottom: 0;
|
@@ -53,81 +76,48 @@ const StrikedLine = styled('div', strikedAttrs)`
|
|
53
76
|
justify-content: center;
|
54
77
|
width: 143%;
|
55
78
|
height: 8%;
|
56
|
-
background-color: ${(
|
57
|
-
props.theme.colors[props.color] || props.color};
|
79
|
+
background-color: ${({ theme }) => theme.colors[props.color] || props.color};
|
58
80
|
min-height: 0;
|
59
81
|
line-height: 0;
|
60
82
|
transform-origin: 0% 100%;
|
61
83
|
transform: rotate(-45deg);
|
62
84
|
`
|
63
|
-
const
|
64
|
-
const IconImage = styled('div', IconImageProps)`
|
85
|
+
const IconImage = styled.div`
|
65
86
|
width: 100%;
|
66
87
|
svg {
|
67
88
|
width: 100%;
|
68
89
|
height: 100%;
|
69
90
|
}
|
70
91
|
svg path {
|
71
|
-
${(
|
72
|
-
props.color && `fill: ${
|
92
|
+
${({ theme }) =>
|
93
|
+
props.color && `fill: ${theme.colors[props.color] || props.color};`}
|
73
94
|
}
|
74
95
|
&:hover > svg path {
|
75
|
-
${
|
96
|
+
${props.hoveredColor && `fill: ${props.hoveredColor};`}
|
76
97
|
}
|
77
98
|
&:hover + div {
|
78
|
-
background-color: ${
|
99
|
+
background-color: ${props.hoveredColor};
|
79
100
|
}
|
80
101
|
`
|
81
102
|
|
82
|
-
const props = defineProps({
|
83
|
-
disabled: {
|
84
|
-
required: false,
|
85
|
-
default: false
|
86
|
-
},
|
87
|
-
name: {
|
88
|
-
required: true
|
89
|
-
},
|
90
|
-
color: {
|
91
|
-
required: false
|
92
|
-
},
|
93
|
-
hoveredColor: {
|
94
|
-
required: false
|
95
|
-
},
|
96
|
-
size: {
|
97
|
-
required: false,
|
98
|
-
default: '30px'
|
99
|
-
},
|
100
|
-
cursor: {
|
101
|
-
required: false,
|
102
|
-
default: null
|
103
|
-
},
|
104
|
-
isStriked: {
|
105
|
-
required: false,
|
106
|
-
default: false
|
107
|
-
}
|
108
|
-
})
|
109
|
-
|
110
103
|
const icon = reactive({ html: '' })
|
111
104
|
|
112
|
-
const iconTest = reactive({ html: '' })
|
113
|
-
const iconName = ''
|
114
105
|
const loadSvg = async (fileName = props.name) => {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
const
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
106
|
+
const _fileName = fileName.toLowerCase()
|
107
|
+
// We need to use "new URL" to load dynamic assets (https://vitejs.dev/guide/assets.html#new-url-url-import-meta-url)
|
108
|
+
const fetchUrl = new URL(
|
109
|
+
`../../assets/svgIcons/${_fileName}.svg`,
|
110
|
+
import.meta.url
|
111
|
+
).href
|
112
|
+
try {
|
113
|
+
const fetchResponse = await fetch(fetchUrl)
|
114
|
+
icon.html = await fetchResponse.text()
|
115
|
+
} catch (error) {
|
116
|
+
console.error(`Failed to load ${props.name}.svg`)
|
117
|
+
}
|
127
118
|
}
|
128
119
|
|
129
|
-
onMounted(() => handleLoadAsyncIcon())
|
130
120
|
onMounted(() => loadSvg())
|
131
121
|
|
132
|
-
watch(() => props.name,
|
122
|
+
watch(() => props.name, loadSvg)
|
133
123
|
</script>
|
@@ -721,9 +721,9 @@ export default {
|
|
721
721
|
},
|
722
722
|
isSelectDropdownShown() {
|
723
723
|
return (
|
724
|
-
this.isSearchable &&
|
725
724
|
this.isDropdownOpen &&
|
726
|
-
this.dropdownPosition.left !== null
|
725
|
+
this.dropdownPosition.left !== null &&
|
726
|
+
(!this.isSearchable || this.isSearchable)
|
727
727
|
)
|
728
728
|
}
|
729
729
|
},
|