@eturnity/eturnity_reusable_components 6.48.0-EPDM-7260.0 → 6.48.0-EPDM-8148.8
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 +1 -1
- package/src/assets/svgIcons/integrations.svg +3 -0
- package/src/components/iconWrapper/index.vue +79 -57
- package/src/components/inputs/inputNumber/index.vue +1 -1
- package/src/components/inputs/select/index.vue +5 -1
- package/src/components/inputs/select/option/index.vue +45 -6
- package/src/components/modals/modal/index.vue +1 -1
- package/src/components/tableDropdown/index.vue +2 -0
- package/src/helpers/numberConverter.js +4 -12
- package/src/components/selectedOptions/index.vue +0 -130
package/package.json
CHANGED
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 0H11H16C17.1046 0 18 0.895431 18 2V12H12C10.8954 12 10 11.1046 10 10V4L0 4V2C0 0.89543 0.895431 0 2 0H10ZM0 6H6C7.10457 6 8 6.89543 8 8V14H18V16C18 17.1046 17.1046 18 16 18H8H7H2C0.895431 18 0 17.1046 0 16V6Z" fill="white"/>
|
3
|
+
</svg>
|
@@ -8,63 +8,85 @@
|
|
8
8
|
:color="iconColor"
|
9
9
|
:hoveredBackgroundColor="hoveredBackgroundColor"
|
10
10
|
:isHovered="isHovered"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
11
|
+
>
|
12
|
+
<icon
|
13
|
+
:disabled="disabled"
|
14
|
+
:size="iconSize"
|
15
|
+
:name="name"
|
16
|
+
:color="iconColor"
|
17
|
+
:hoveredColor="hoveredIconColor"
|
18
|
+
:isStriked="isStriked"
|
19
|
+
/>
|
20
|
+
|
21
|
+
<caret v-if="hasCaret">
|
22
|
+
<iconWrapper
|
23
|
+
:disabled="disabled"
|
24
|
+
size="10px"
|
25
|
+
name="arrow_down"
|
26
|
+
:iconColor="iconColor"
|
27
|
+
:hoveredBackgroundColor="hoveredIconColor"
|
28
|
+
borderRadius="1px"
|
29
|
+
/>
|
30
|
+
</caret>
|
31
|
+
</Wrapper>
|
32
|
+
</template>
|
33
|
+
|
34
|
+
<script>
|
35
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
36
|
+
// How to use:
|
37
|
+
//<icon
|
38
|
+
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
39
|
+
// color="red"
|
40
|
+
// hoveredColor="blue"
|
41
|
+
// size="60px" by default, this is 30px
|
42
|
+
// />
|
43
|
+
|
44
|
+
import styled from 'vue-styled-components'
|
45
|
+
import icon from '../icon'
|
46
|
+
const wrapperAttrs = {
|
47
|
+
color: String,
|
48
|
+
isHovered: Boolean,
|
49
|
+
borderRadius: String,
|
50
|
+
disabled: Boolean,
|
51
|
+
size: String,
|
52
|
+
backgroundColor: String,
|
53
|
+
hoveredBackgroundColor: String,
|
54
|
+
hasBorder: Boolean
|
55
|
+
}
|
56
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
57
|
+
position: relative;
|
58
|
+
display: inline-flex;
|
59
|
+
width: ${(props) => props.size};
|
60
|
+
height: ${(props) => props.size};
|
61
|
+
border: ${(props) =>
|
62
|
+
props.hasBorder
|
63
|
+
? 'solid 1px ' + props.theme.colors[props.color] || props.color
|
64
|
+
: ''};
|
65
|
+
justify-content: center;
|
66
|
+
align-items: center;
|
67
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
68
|
+
background-color: ${(props) =>
|
69
|
+
props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
70
|
+
border-radius: ${(props) => props.borderRadius};
|
71
|
+
${(props) =>
|
72
|
+
props.isHovered
|
73
|
+
? 'background-color:' +
|
74
|
+
props.theme.colors[props.hoveredBackgroundColor] ||
|
75
|
+
props.hoveredBackgroundColor
|
76
|
+
: ''};
|
77
|
+
&:hover {
|
78
|
+
background-color: ${(props) =>
|
79
|
+
props.theme.colors[props.hoveredBackgroundColor] ||
|
80
|
+
props.hoveredBackgroundColor};
|
81
|
+
}
|
82
|
+
`
|
83
|
+
const caret = styled.div`
|
84
|
+
position: absolute;
|
85
|
+
bottom: 3px;
|
86
|
+
right: 2px;
|
87
|
+
height: 10px;
|
88
|
+
`
|
89
|
+
|
68
90
|
export default {
|
69
91
|
name: 'iconWrapper',
|
70
92
|
components: {
|
@@ -492,10 +492,14 @@ export default {
|
|
492
492
|
this.toggleDropdown()
|
493
493
|
},
|
494
494
|
clickOutside(event) {
|
495
|
+
const dropdownRef = this.$refs.dropdown
|
496
|
+
// we need to prevent closing on selecting an option, because in the case of
|
497
|
+
// a disabled option, we don't want to close the dropdown
|
495
498
|
if (!this.isClickOutsideActive) return
|
496
499
|
if (
|
497
500
|
this.$refs.select.$el == event.target ||
|
498
|
-
this.$refs.select.$el.contains(event.target)
|
501
|
+
this.$refs.select.$el.contains(event.target) ||
|
502
|
+
event.target.parentNode === dropdownRef.$el
|
499
503
|
) {
|
500
504
|
return
|
501
505
|
} else {
|
@@ -1,10 +1,18 @@
|
|
1
1
|
<template>
|
2
2
|
<optionContainer
|
3
3
|
:data-value="value"
|
4
|
-
:hoveredBgColor="
|
5
|
-
|
4
|
+
:hoveredBgColor="
|
5
|
+
colorMode == 'dark'
|
6
|
+
? '#000000'
|
7
|
+
: hoveredBgColor
|
8
|
+
? hoveredBgColor
|
9
|
+
: 'grey5'
|
10
|
+
"
|
6
11
|
@click="clickHandler"
|
7
12
|
@mouseover="hoverHandler"
|
13
|
+
:cursorType="cursorType"
|
14
|
+
:backgroundColor="colorMode == 'dark' ? '#000000' : backgroundColor"
|
15
|
+
:title="hoverText"
|
8
16
|
>
|
9
17
|
<slot></slot>
|
10
18
|
</optionContainer>
|
@@ -14,18 +22,29 @@
|
|
14
22
|
// import selectButton from './selectButton'
|
15
23
|
// import selectDropdown from './selectDropDown'
|
16
24
|
import styled from 'vue-styled-components'
|
17
|
-
const optionProps = {
|
25
|
+
const optionProps = {
|
26
|
+
hoveredBgColor: String,
|
27
|
+
cursorType: String,
|
28
|
+
backgroundColor: String
|
29
|
+
}
|
18
30
|
const optionContainer = styled('div', optionProps)`
|
19
31
|
display: flex;
|
20
|
-
cursor:
|
32
|
+
cursor: ${(props) => props.cursorType};
|
21
33
|
flex-direction: row;
|
22
34
|
justify-content: space-between;
|
23
35
|
align-items: center;
|
24
36
|
padding: 12px 10px;
|
25
37
|
gap: 14px;
|
26
38
|
width: 100%;
|
27
|
-
background-color: ${(props) =>
|
39
|
+
background-color: ${(props) =>
|
40
|
+
props.theme.colors[props.backgroundColor]
|
41
|
+
? props.theme.colors[props.backgroundColor]
|
42
|
+
: props.backgroundColor};
|
28
43
|
box-sizing: inherit;
|
44
|
+
background-color: ${(props) =>
|
45
|
+
props.theme.colors[props.backgroundColor]
|
46
|
+
? props.theme.colors[props.backgroundColor]
|
47
|
+
: props.backgroundColor};
|
29
48
|
&:hover {
|
30
49
|
background-color: ${(props) =>
|
31
50
|
props.theme.colors[props.hoveredBgColor]
|
@@ -47,6 +66,21 @@ export default {
|
|
47
66
|
colorMode: {
|
48
67
|
required: false,
|
49
68
|
default: 'light'
|
69
|
+
},
|
70
|
+
cursorType: {
|
71
|
+
required: false,
|
72
|
+
default: 'cursor'
|
73
|
+
},
|
74
|
+
backgroundColor: {
|
75
|
+
required: false,
|
76
|
+
default: 'white'
|
77
|
+
},
|
78
|
+
hoverText: {
|
79
|
+
required: false
|
80
|
+
},
|
81
|
+
isDisabled: {
|
82
|
+
required: false,
|
83
|
+
default: false
|
50
84
|
}
|
51
85
|
},
|
52
86
|
|
@@ -57,7 +91,12 @@ export default {
|
|
57
91
|
},
|
58
92
|
methods: {
|
59
93
|
clickHandler() {
|
60
|
-
|
94
|
+
if (this.isDisabled) {
|
95
|
+
// prevent emitter if the option is disabled
|
96
|
+
return
|
97
|
+
} else {
|
98
|
+
this.$parent.$emit('option-selected', this.value)
|
99
|
+
}
|
61
100
|
},
|
62
101
|
hoverHandler() {
|
63
102
|
this.$parent.$emit('option-hovered', this.value)
|
@@ -37,7 +37,7 @@ const ContentContainer = styled('div', contentAttrs)`
|
|
37
37
|
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
38
38
|
`
|
39
39
|
|
40
|
-
const pageAttrs = { isOpen: Boolean, backdrop: String,position:String }
|
40
|
+
const pageAttrs = { isOpen: Boolean, backdrop: String, position: String }
|
41
41
|
const PageWrapper = styled('div', pageAttrs)`
|
42
42
|
position: ${(props) => props.position}
|
43
43
|
display: grid;
|
@@ -134,11 +134,13 @@
|
|
134
134
|
{{ !!item[option] ? item[option] : '-' }}
|
135
135
|
</span>
|
136
136
|
<template-button
|
137
|
+
:key="idx"
|
137
138
|
@click.stop="onTemplateClick(item)"
|
138
139
|
v-else-if="option === 'template' && item.has_template"
|
139
140
|
>{{ $gettext('Use template...') }}</template-button
|
140
141
|
>
|
141
142
|
<no-template
|
143
|
+
:key="idx"
|
142
144
|
v-else-if="option === 'template' && !item.has_template"
|
143
145
|
>
|
144
146
|
{{ $gettext('No main component template') }}
|
@@ -91,19 +91,11 @@ export const stringToNumber = ({
|
|
91
91
|
return parseFloat(newVal)
|
92
92
|
}
|
93
93
|
|
94
|
-
export const numberToString = ({ value, numberPrecision
|
94
|
+
export const numberToString = ({ value, numberPrecision, minDecimals }) => {
|
95
|
+
const minimumRounding = minDecimals ? minDecimals : 0
|
95
96
|
value = parseFloat(value)
|
96
|
-
let minNumberPrecision
|
97
|
-
let maxNumberPrecision
|
98
|
-
if (typeof numberPrecision === 'number') {
|
99
|
-
minNumberPrecision = numberPrecision
|
100
|
-
maxNumberPrecision = numberPrecision
|
101
|
-
} else {
|
102
|
-
minNumberPrecision = numberPrecision[0]
|
103
|
-
maxNumberPrecision = numberPrecision[1]
|
104
|
-
}
|
105
97
|
return value.toLocaleString(langForLocaleString(), {
|
106
|
-
minimumFractionDigits:
|
107
|
-
maximumFractionDigits:
|
98
|
+
minimumFractionDigits: minimumRounding, // removing this for now. Why do we need this to be a minimum amount?
|
99
|
+
maximumFractionDigits: numberPrecision
|
108
100
|
})
|
109
101
|
}
|
@@ -1,130 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<page-container>
|
3
|
-
<box-container>
|
4
|
-
<selected-container
|
5
|
-
>{{ numberSelected }} {{ $gettext('selected') }}</selected-container
|
6
|
-
>
|
7
|
-
<list-container>
|
8
|
-
<list-item
|
9
|
-
v-for="item in optionsList"
|
10
|
-
:key="item.type"
|
11
|
-
:hoverColor="item.hoverColor"
|
12
|
-
@click="$emit('on-' + item.type)"
|
13
|
-
>
|
14
|
-
{{ item.name }}
|
15
|
-
</list-item>
|
16
|
-
</list-container>
|
17
|
-
<icon-container @click="$emit('on-close')">
|
18
|
-
<icon
|
19
|
-
name="close_for_modals,_tool_tips"
|
20
|
-
color="white"
|
21
|
-
size="14px"
|
22
|
-
cursor="pointer"
|
23
|
-
/>
|
24
|
-
</icon-container>
|
25
|
-
</box-container>
|
26
|
-
</page-container>
|
27
|
-
</template>
|
28
|
-
|
29
|
-
<script>
|
30
|
-
// import SelectedOptions from "@eturnity/eturnity_reusable_components/src/components/selectedOptions"
|
31
|
-
// optionsList = [
|
32
|
-
// {
|
33
|
-
// type: 'export',
|
34
|
-
// name: 'Export'
|
35
|
-
// },
|
36
|
-
// {
|
37
|
-
// type: 'delete',
|
38
|
-
// name: 'Delete',
|
39
|
-
// hoverColor: 'red' // default is green
|
40
|
-
// }
|
41
|
-
// ]
|
42
|
-
// @on-${type}="function" should $emit the callback for the 'type' in the optionsList
|
43
|
-
// <selected-options :optionsList="optionsList" @on-close="onCloseFunction()" @on-export="function()" @on-delete="function()" />
|
44
|
-
import styled from 'vue-styled-components'
|
45
|
-
import Icon from '../icon'
|
46
|
-
|
47
|
-
const PageContainer = styled.div`
|
48
|
-
position: fixed;
|
49
|
-
bottom: 30px;
|
50
|
-
left: 50%;
|
51
|
-
transform: translateX(-50%);
|
52
|
-
`
|
53
|
-
|
54
|
-
const SelectedContainer = styled.div`
|
55
|
-
display: grid;
|
56
|
-
align-items: center;
|
57
|
-
height: 100%;
|
58
|
-
padding-right: 20px;
|
59
|
-
border-right: 1px solid rgba(255, 255, 255, 0.2);
|
60
|
-
`
|
61
|
-
|
62
|
-
const BoxContainer = styled.div`
|
63
|
-
display: flex;
|
64
|
-
align-items: center;
|
65
|
-
background-color: ${(props) => props.theme.colors.black};
|
66
|
-
opacity: 90%;
|
67
|
-
color: ${(props) => props.theme.colors.white};
|
68
|
-
border-radius: 4px;
|
69
|
-
padding: 8px 10px 8px 20px;
|
70
|
-
font-size: 14px;
|
71
|
-
height: 40px;
|
72
|
-
`
|
73
|
-
|
74
|
-
const ListContainer = styled.div`
|
75
|
-
padding: 0 20px;
|
76
|
-
display: flex;
|
77
|
-
gap: 20px;
|
78
|
-
color: ${(props) => props.theme.colors.white};
|
79
|
-
`
|
80
|
-
|
81
|
-
const ListAttrs = {
|
82
|
-
hoverColor: String
|
83
|
-
}
|
84
|
-
const ListItem = styled('div', ListAttrs)`
|
85
|
-
cursor: pointer;
|
86
|
-
&:hover {
|
87
|
-
color: ${(props) =>
|
88
|
-
props.hoverColor
|
89
|
-
? props.theme.colors[props.hoverColor]
|
90
|
-
: props.theme.colors.green};
|
91
|
-
}
|
92
|
-
`
|
93
|
-
|
94
|
-
const IconContainer = styled.div`
|
95
|
-
display: grid;
|
96
|
-
align-items: center;
|
97
|
-
justify-items: center;
|
98
|
-
height: 30px;
|
99
|
-
width: 30px;
|
100
|
-
cursor: pointer;
|
101
|
-
margin-left: 20px;
|
102
|
-
|
103
|
-
&:hover {
|
104
|
-
background: rgba(255, 255, 255, 0.1);
|
105
|
-
border-radius: 4px;
|
106
|
-
}
|
107
|
-
`
|
108
|
-
|
109
|
-
export default {
|
110
|
-
name: 'selected-options',
|
111
|
-
components: {
|
112
|
-
PageContainer,
|
113
|
-
BoxContainer,
|
114
|
-
SelectedContainer,
|
115
|
-
ListContainer,
|
116
|
-
ListItem,
|
117
|
-
Icon,
|
118
|
-
IconContainer
|
119
|
-
},
|
120
|
-
props: {
|
121
|
-
optionsList: {
|
122
|
-
required: true
|
123
|
-
},
|
124
|
-
numberSelected: {
|
125
|
-
required: true,
|
126
|
-
default: 0
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
</script>
|