@eturnity/eturnity_reusable_components 6.48.2-EPDM-8134.1 → 6.48.2-test-ext-02.0
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/App.vue +3 -1
- package/src/assets/svgIcons/erase.svg +1 -1
- package/src/assets/svgIcons/integrations.svg +3 -0
- package/src/components/icon/iconCollection.vue +5 -5
- package/src/components/icon/index.vue +1 -2
- package/src/components/iconWrapper/index.vue +79 -57
- package/src/components/infoCard/index.vue +38 -0
- package/src/components/inputs/inputNumber/index.vue +23 -9
- package/src/components/inputs/select/index.vue +5 -1
- package/src/components/inputs/select/option/index.vue +45 -6
- package/src/components/inputs/switchField/index.vue +6 -2
- package/src/components/modals/modal/index.vue +1 -1
- package/src/components/tableDropdown/index.vue +2 -0
- package/src/helpers/numberConverter.js +5 -12
package/package.json
CHANGED
package/src/App.vue
CHANGED
@@ -114,6 +114,7 @@ import iconCollection from '@/components/icon/iconCollection'
|
|
114
114
|
import dropdownComponent from '@/components/dropdown'
|
115
115
|
import videoThumbnail from '@/components/videoThumbnail'
|
116
116
|
import icon from '@/components/icon'
|
117
|
+
import infoCard from '@/components/infoCard'
|
117
118
|
// import TableDropdown from "@/components/tableDropdown"
|
118
119
|
|
119
120
|
const PageContainer = styled.div`
|
@@ -138,7 +139,8 @@ export default {
|
|
138
139
|
iconCollection,
|
139
140
|
dropdownComponent,
|
140
141
|
videoThumbnail,
|
141
|
-
icon
|
142
|
+
icon,
|
143
|
+
infoCard
|
142
144
|
},
|
143
145
|
data() {
|
144
146
|
return {
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<svg fill="none" height="16" viewbox="12 12 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<circle cx="20" cy="20" r="7"></circle>
|
2
|
+
<circle cx="20" cy="20" fill="white" r="7"></circle>
|
3
3
|
<path d="M24.9592 15.0408C22.2382 12.3197 17.7618 12.3197 15.0408 15.0408C12.3197 17.7618 12.3197 22.2382 15.0408 24.9592C17.7618 27.6803 22.2382 27.6803 24.9592 24.9592C27.6803 22.2382 27.6803 17.8495 24.9592 15.0408ZM23.6426 22.5016L22.4138 23.7304L19.9561 21.2727L17.4984 23.7304L16.2696 22.5016L18.7273 20.0439L16.2696 17.5862L17.4984 16.3574L19.9561 18.815L22.4138 16.3574L23.6426 17.5862L21.185 20.0439L23.6426 22.5016Z" fill="#FF5656"></path>
|
4
4
|
</svg>
|
@@ -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>
|
@@ -20,13 +20,13 @@ import styled from 'vue-styled-components'
|
|
20
20
|
|
21
21
|
const Wrapper = styled.div`
|
22
22
|
display: block;
|
23
|
-
text-align:
|
24
|
-
justify-items:
|
25
|
-
width:
|
26
|
-
background-color
|
23
|
+
text-align:center;
|
24
|
+
justify-items:center
|
25
|
+
width:100%;
|
26
|
+
background-color:#ccc;
|
27
27
|
`
|
28
28
|
const IconWrapper = styled.div`
|
29
|
-
display:
|
29
|
+
display:inline-flex
|
30
30
|
flex-direction: column;
|
31
31
|
background-color: white;
|
32
32
|
border-radius: 6px;
|
@@ -30,7 +30,7 @@ import styled from 'vue-styled-components'
|
|
30
30
|
const wrapperAttrs = { isDisabled: Boolean, size: String, cursor: String }
|
31
31
|
const Wrapper = styled('div', wrapperAttrs)`
|
32
32
|
display: flex;
|
33
|
-
position:
|
33
|
+
position:relative
|
34
34
|
align-content: center;
|
35
35
|
justify-content: center;
|
36
36
|
width: ${(props) => props.size};
|
@@ -58,7 +58,6 @@ const strikedLine = styled('div', strikedAttrs)`
|
|
58
58
|
`
|
59
59
|
const IconImageProps = { color: String, hoveredColor: String, size: String }
|
60
60
|
const IconImage = styled('div', IconImageProps)`
|
61
|
-
width: 100%;
|
62
61
|
svg {
|
63
62
|
width: 100%;
|
64
63
|
height: 100%;
|
@@ -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: {
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<template>
|
2
|
+
<info-container>
|
3
|
+
<icon name="info" size="24px" />
|
4
|
+
<InfoTextContainer>
|
5
|
+
<slot />
|
6
|
+
</InfoTextContainer>
|
7
|
+
</info-container>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
import styled from 'vue-styled-components'
|
12
|
+
import icon from '../icon'
|
13
|
+
const InfoContainer = styled('div')`
|
14
|
+
display: flex;
|
15
|
+
align-items: flex-start;
|
16
|
+
gap: 15px;
|
17
|
+
padding: 20px;
|
18
|
+
width: 500px;
|
19
|
+
min-width: 450px;
|
20
|
+
border: 1px dashed #dee2eb;
|
21
|
+
border-radius: 4px;
|
22
|
+
margin:20px 0;
|
23
|
+
`
|
24
|
+
|
25
|
+
const InfoTextContainer = styled('div')`
|
26
|
+
font-size: 13px;
|
27
|
+
`
|
28
|
+
|
29
|
+
|
30
|
+
export default {
|
31
|
+
components:{
|
32
|
+
icon,
|
33
|
+
InfoTextContainer,
|
34
|
+
InfoContainer
|
35
|
+
},
|
36
|
+
props:[]
|
37
|
+
}
|
38
|
+
</script>
|
@@ -84,6 +84,7 @@
|
|
84
84
|
// inputWidth="150px" //by default, this is 100%
|
85
85
|
// minWidth="100px"
|
86
86
|
// :numberPrecision="3"
|
87
|
+
// minDecimals="2"
|
87
88
|
// unitName="pc"
|
88
89
|
// :value="inputValue" //required -- String
|
89
90
|
// @input-change="onInputChange($event)" //required
|
@@ -358,6 +359,10 @@ export default {
|
|
358
359
|
required: false,
|
359
360
|
default: 0
|
360
361
|
},
|
362
|
+
minDecimals: {
|
363
|
+
required: false,
|
364
|
+
default: 0
|
365
|
+
},
|
361
366
|
unitName: {
|
362
367
|
required: false,
|
363
368
|
default: ''
|
@@ -498,7 +503,8 @@ export default {
|
|
498
503
|
} else {
|
499
504
|
let num = stringToNumber({
|
500
505
|
value: item,
|
501
|
-
numberPrecision: false
|
506
|
+
numberPrecision: false,
|
507
|
+
minDecimals: this.minDecimals
|
502
508
|
})
|
503
509
|
return num
|
504
510
|
}
|
@@ -509,7 +515,8 @@ export default {
|
|
509
515
|
if (typeof evaluated === 'string') {
|
510
516
|
evaluated = stringToNumber({
|
511
517
|
value: evaluated,
|
512
|
-
numberPrecision: this.numberPrecision
|
518
|
+
numberPrecision: this.numberPrecision,
|
519
|
+
minDecimals: this.minDecimals
|
513
520
|
})
|
514
521
|
} else if (typeof evaluated === 'number') {
|
515
522
|
evaluated = evaluated.toFixed(this.numberPrecision)
|
@@ -569,7 +576,8 @@ export default {
|
|
569
576
|
: this.defaultNumber
|
570
577
|
? this.defaultNumber
|
571
578
|
: this.minNumber,
|
572
|
-
numberPrecision: this.numberPrecision
|
579
|
+
numberPrecision: this.numberPrecision,
|
580
|
+
minDecimals: this.minDecimals
|
573
581
|
})
|
574
582
|
}
|
575
583
|
let adjustedMinValue =
|
@@ -614,7 +622,8 @@ export default {
|
|
614
622
|
let input = this.numberToStringEnabled
|
615
623
|
? numberToString({
|
616
624
|
value: adjustedMinValue,
|
617
|
-
numberPrecision: this.numberPrecision
|
625
|
+
numberPrecision: this.numberPrecision,
|
626
|
+
minDecimals: this.minDecimals
|
618
627
|
})
|
619
628
|
: adjustedMinValue
|
620
629
|
let unit = this.showLinearUnitName ? '' : this.unitName
|
@@ -626,7 +635,8 @@ export default {
|
|
626
635
|
return this.numberToStringEnabled
|
627
636
|
? numberToString({
|
628
637
|
value: adjustedMinValue,
|
629
|
-
numberPrecision: this.numberPrecision
|
638
|
+
numberPrecision: this.numberPrecision,
|
639
|
+
minDecimals: this.minDecimals
|
630
640
|
})
|
631
641
|
: adjustedMinValue
|
632
642
|
}
|
@@ -645,7 +655,8 @@ export default {
|
|
645
655
|
|
646
656
|
this.textInput = numberToString({
|
647
657
|
value: value && value.length ? value : this.minNumber,
|
648
|
-
numberPrecision: this.numberPrecision
|
658
|
+
numberPrecision: this.numberPrecision,
|
659
|
+
minDecimals: this.minDecimals
|
649
660
|
})
|
650
661
|
//this.value=value
|
651
662
|
},
|
@@ -660,17 +671,20 @@ export default {
|
|
660
671
|
if (this.value) {
|
661
672
|
this.textInput = numberToString({
|
662
673
|
value: this.value,
|
663
|
-
numberPrecision: this.numberPrecision
|
674
|
+
numberPrecision: this.numberPrecision,
|
675
|
+
minDecimals: this.minDecimals
|
664
676
|
})
|
665
677
|
} else if (this.defaultNumber !== null) {
|
666
678
|
this.textInput = numberToString({
|
667
679
|
value: this.defaultNumber,
|
668
|
-
numberPrecision: this.numberPrecision
|
680
|
+
numberPrecision: this.numberPrecision,
|
681
|
+
minDecimals: this.minDecimals
|
669
682
|
})
|
670
683
|
} else if (this.minNumber !== null) {
|
671
684
|
this.textInput = numberToString({
|
672
685
|
value: this.minNumber,
|
673
|
-
numberPrecision: this.numberPrecision
|
686
|
+
numberPrecision: this.numberPrecision,
|
687
|
+
minDecimals: this.minDecimals
|
674
688
|
})
|
675
689
|
}
|
676
690
|
},
|
@@ -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)
|
@@ -10,6 +10,8 @@
|
|
10
10
|
v-if="label && labelAlign === 'left'"
|
11
11
|
:hasInfoMessage="!!infoTextMessage"
|
12
12
|
:colorMode="colorMode"
|
13
|
+
:primaryColor="primaryColor"
|
14
|
+
:secondaryColor="secondaryColor"
|
13
15
|
>
|
14
16
|
<label-text :size="size">{{ label }}</label-text>
|
15
17
|
<info-text
|
@@ -99,10 +101,12 @@ const toggleAttrs = {
|
|
99
101
|
fontColor: String,
|
100
102
|
disabled: Boolean,
|
101
103
|
backgroundColor: String,
|
102
|
-
isChecked: Boolean
|
104
|
+
isChecked: Boolean,
|
105
|
+
secondaryColor: String,
|
106
|
+
primaryColor: String,
|
103
107
|
}
|
104
108
|
const LabelText = styled('div', toggleAttrs)`
|
105
|
-
color:
|
109
|
+
color: ${(props) => props.primaryColor };
|
106
110
|
font-size: 13px;
|
107
111
|
font-weight: 700;
|
108
112
|
`
|
@@ -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,12 @@ 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:
|
100
|
+
numberPrecision < minimumRounding ? minimumRounding : numberPrecision
|
108
101
|
})
|
109
102
|
}
|