@eturnity/eturnity_reusable_components 6.48.0-EPDM-8148.8 → 6.48.0-EPDM-8891.4
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/components/iconWrapper/index.vue +57 -79
- package/src/components/inputs/inputNumber/index.vue +24 -10
- package/src/components/inputs/select/index.vue +10 -6
- package/src/components/inputs/select/option/index.vue +6 -45
- package/src/components/modals/modal/index.vue +1 -1
- package/src/components/tableDropdown/index.vue +0 -2
- package/src/helpers/numberConverter.js +12 -4
- package/src/assets/svgIcons/integrations.svg +0 -3
package/package.json
CHANGED
@@ -8,85 +8,63 @@
|
|
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
|
-
|
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
|
-
|
11
|
+
>
|
12
|
+
<icon :disabled="disabled"
|
13
|
+
:size="iconSize"
|
14
|
+
:name="name"
|
15
|
+
:color="iconColor"
|
16
|
+
:hoveredColor="hoveredIconColor"
|
17
|
+
:isStriked="isStriked"
|
18
|
+
/>
|
19
|
+
|
20
|
+
<caret v-if="hasCaret">
|
21
|
+
<iconWrapper :disabled="disabled"
|
22
|
+
size="10px"
|
23
|
+
name="arrow_down"
|
24
|
+
:iconColor="iconColor"
|
25
|
+
:hoveredBackgroundColor="hoveredIconColor"
|
26
|
+
borderRadius="1px"
|
27
|
+
/>
|
28
|
+
</caret>
|
29
|
+
</Wrapper>
|
30
|
+
</template>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
34
|
+
// How to use:
|
35
|
+
//<icon
|
36
|
+
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
37
|
+
// color="red"
|
38
|
+
// hoveredColor="blue"
|
39
|
+
// size="60px" by default, this is 30px
|
40
|
+
// />
|
41
|
+
|
42
|
+
import styled from 'vue-styled-components'
|
43
|
+
import icon from '../icon'
|
44
|
+
const wrapperAttrs = { color: String, isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String,hasBorder:Boolean }
|
45
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
46
|
+
position:relative;
|
47
|
+
display: inline-flex;
|
48
|
+
width: ${(props) => props.size};
|
49
|
+
height: ${(props) => props.size};
|
50
|
+
border: ${(props) => props.hasBorder? 'solid 1px '+props.theme.colors[props.color] || props.color : ""};
|
51
|
+
justify-content:center;
|
52
|
+
align-items:center;
|
53
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
54
|
+
background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
55
|
+
border-radius: ${(props) => props.borderRadius};
|
56
|
+
${(props)=>(props.isHovered ? 'background-color:'+props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor : "")};
|
57
|
+
&:hover{
|
58
|
+
background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
|
59
|
+
}
|
60
|
+
`
|
61
|
+
const caret=styled.div`
|
62
|
+
position:absolute;
|
63
|
+
bottom:3px;
|
64
|
+
right:2px;
|
65
|
+
height:10px;
|
66
|
+
`
|
67
|
+
|
90
68
|
export default {
|
91
69
|
name: 'iconWrapper',
|
92
70
|
components: {
|
@@ -83,6 +83,7 @@
|
|
83
83
|
// inputWidth="150px" //by default, this is 100%
|
84
84
|
// minWidth="100px"
|
85
85
|
// :numberPrecision="3"
|
86
|
+
// minDecimals="2"
|
86
87
|
// unitName="pc"
|
87
88
|
// :value="inputValue" //required -- String
|
88
89
|
// @input-change="onInputChange($event)" //required
|
@@ -357,6 +358,10 @@ export default {
|
|
357
358
|
required: false,
|
358
359
|
default: 0
|
359
360
|
},
|
361
|
+
minDecimals: {
|
362
|
+
required: false,
|
363
|
+
default: 0
|
364
|
+
},
|
360
365
|
unitName: {
|
361
366
|
required: false,
|
362
367
|
default: ''
|
@@ -471,7 +476,7 @@ export default {
|
|
471
476
|
? this.minNumber
|
472
477
|
: event
|
473
478
|
}
|
474
|
-
if (!this.allowNegative
|
479
|
+
if (!this.allowNegative) {
|
475
480
|
event = Math.abs(event)
|
476
481
|
}
|
477
482
|
event = parseFloat(event)
|
@@ -497,7 +502,8 @@ export default {
|
|
497
502
|
} else {
|
498
503
|
let num = stringToNumber({
|
499
504
|
value: item,
|
500
|
-
numberPrecision: false
|
505
|
+
numberPrecision: false,
|
506
|
+
minDecimals: this.minDecimals
|
501
507
|
})
|
502
508
|
return num
|
503
509
|
}
|
@@ -508,7 +514,8 @@ export default {
|
|
508
514
|
if (typeof evaluated === 'string') {
|
509
515
|
evaluated = stringToNumber({
|
510
516
|
value: evaluated,
|
511
|
-
numberPrecision: this.numberPrecision
|
517
|
+
numberPrecision: this.numberPrecision,
|
518
|
+
minDecimals: this.minDecimals
|
512
519
|
})
|
513
520
|
} else if (typeof evaluated === 'number') {
|
514
521
|
evaluated = evaluated.toFixed(this.numberPrecision)
|
@@ -568,7 +575,8 @@ export default {
|
|
568
575
|
: this.defaultNumber
|
569
576
|
? this.defaultNumber
|
570
577
|
: this.minNumber,
|
571
|
-
numberPrecision: this.numberPrecision
|
578
|
+
numberPrecision: this.numberPrecision,
|
579
|
+
minDecimals: this.minDecimals
|
572
580
|
})
|
573
581
|
}
|
574
582
|
let adjustedMinValue =
|
@@ -613,7 +621,8 @@ export default {
|
|
613
621
|
let input = this.numberToStringEnabled
|
614
622
|
? numberToString({
|
615
623
|
value: adjustedMinValue,
|
616
|
-
numberPrecision: this.numberPrecision
|
624
|
+
numberPrecision: this.numberPrecision,
|
625
|
+
minDecimals: this.minDecimals
|
617
626
|
})
|
618
627
|
: adjustedMinValue
|
619
628
|
let unit = this.showLinearUnitName ? '' : this.unitName
|
@@ -625,7 +634,8 @@ export default {
|
|
625
634
|
return this.numberToStringEnabled
|
626
635
|
? numberToString({
|
627
636
|
value: adjustedMinValue,
|
628
|
-
numberPrecision: this.numberPrecision
|
637
|
+
numberPrecision: this.numberPrecision,
|
638
|
+
minDecimals: this.minDecimals
|
629
639
|
})
|
630
640
|
: adjustedMinValue
|
631
641
|
}
|
@@ -644,7 +654,8 @@ export default {
|
|
644
654
|
|
645
655
|
this.textInput = numberToString({
|
646
656
|
value: value && value.length ? value : this.minNumber,
|
647
|
-
numberPrecision: this.numberPrecision
|
657
|
+
numberPrecision: this.numberPrecision,
|
658
|
+
minDecimals: this.minDecimals
|
648
659
|
})
|
649
660
|
//this.value=value
|
650
661
|
},
|
@@ -659,17 +670,20 @@ export default {
|
|
659
670
|
if (this.value) {
|
660
671
|
this.textInput = numberToString({
|
661
672
|
value: this.value,
|
662
|
-
numberPrecision: this.numberPrecision
|
673
|
+
numberPrecision: this.numberPrecision,
|
674
|
+
minDecimals: this.minDecimals
|
663
675
|
})
|
664
676
|
} else if (this.defaultNumber !== null) {
|
665
677
|
this.textInput = numberToString({
|
666
678
|
value: this.defaultNumber,
|
667
|
-
numberPrecision: this.numberPrecision
|
679
|
+
numberPrecision: this.numberPrecision,
|
680
|
+
minDecimals: this.minDecimals
|
668
681
|
})
|
669
682
|
} else if (this.minNumber !== null) {
|
670
683
|
this.textInput = numberToString({
|
671
684
|
value: this.minNumber,
|
672
|
-
numberPrecision: this.numberPrecision
|
685
|
+
numberPrecision: this.numberPrecision,
|
686
|
+
minDecimals: this.minDecimals
|
673
687
|
})
|
674
688
|
}
|
675
689
|
},
|
@@ -492,14 +492,10 @@ 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
|
498
495
|
if (!this.isClickOutsideActive) return
|
499
496
|
if (
|
500
497
|
this.$refs.select.$el == event.target ||
|
501
|
-
this.$refs.select.$el.contains(event.target)
|
502
|
-
event.target.parentNode === dropdownRef.$el
|
498
|
+
this.$refs.select.$el.contains(event.target)
|
503
499
|
) {
|
504
500
|
return
|
505
501
|
} else {
|
@@ -541,7 +537,15 @@ export default {
|
|
541
537
|
computed: {
|
542
538
|
optionLength() {
|
543
539
|
if (this.isDropdownOpen) {
|
544
|
-
|
540
|
+
// this filterRef is needed to check for the # of children on Filter dropdowns
|
541
|
+
const filterRef =
|
542
|
+
this.$refs.dropdown.$children &&
|
543
|
+
this.$refs.dropdown.$children.length > 1
|
544
|
+
? this.$refs.dropdown.$children
|
545
|
+
: this.$refs.dropdown.$children[0].$children
|
546
|
+
? this.$refs.dropdown.$children[0].$children
|
547
|
+
: this.$refs.dropdown.$children
|
548
|
+
return filterRef.length
|
545
549
|
} else {
|
546
550
|
return 0
|
547
551
|
}
|
@@ -1,18 +1,10 @@
|
|
1
1
|
<template>
|
2
2
|
<optionContainer
|
3
3
|
:data-value="value"
|
4
|
-
:hoveredBgColor="
|
5
|
-
|
6
|
-
? '#000000'
|
7
|
-
: hoveredBgColor
|
8
|
-
? hoveredBgColor
|
9
|
-
: 'grey5'
|
10
|
-
"
|
4
|
+
:hoveredBgColor="colorMode == 'dark' ? '#000000' : 'hoveredBgColor'"
|
5
|
+
:backgroundColor="colorMode == 'dark' ? 'eturnityGrey' : '#fff'"
|
11
6
|
@click="clickHandler"
|
12
7
|
@mouseover="hoverHandler"
|
13
|
-
:cursorType="cursorType"
|
14
|
-
:backgroundColor="colorMode == 'dark' ? '#000000' : backgroundColor"
|
15
|
-
:title="hoverText"
|
16
8
|
>
|
17
9
|
<slot></slot>
|
18
10
|
</optionContainer>
|
@@ -22,29 +14,18 @@
|
|
22
14
|
// import selectButton from './selectButton'
|
23
15
|
// import selectDropdown from './selectDropDown'
|
24
16
|
import styled from 'vue-styled-components'
|
25
|
-
const optionProps = {
|
26
|
-
hoveredBgColor: String,
|
27
|
-
cursorType: String,
|
28
|
-
backgroundColor: String
|
29
|
-
}
|
17
|
+
const optionProps = { hoveredBgColor: String, backgroundColor: String }
|
30
18
|
const optionContainer = styled('div', optionProps)`
|
31
19
|
display: flex;
|
32
|
-
cursor:
|
20
|
+
cursor: pointer;
|
33
21
|
flex-direction: row;
|
34
22
|
justify-content: space-between;
|
35
23
|
align-items: center;
|
36
24
|
padding: 12px 10px;
|
37
25
|
gap: 14px;
|
38
26
|
width: 100%;
|
39
|
-
background-color: ${(props) =>
|
40
|
-
props.theme.colors[props.backgroundColor]
|
41
|
-
? props.theme.colors[props.backgroundColor]
|
42
|
-
: props.backgroundColor};
|
27
|
+
background-color: ${(props) => props.theme.colors[props.backgroundColor]?props.theme.colors[props.backgroundColor]:props.backgroundColor};
|
43
28
|
box-sizing: inherit;
|
44
|
-
background-color: ${(props) =>
|
45
|
-
props.theme.colors[props.backgroundColor]
|
46
|
-
? props.theme.colors[props.backgroundColor]
|
47
|
-
: props.backgroundColor};
|
48
29
|
&:hover {
|
49
30
|
background-color: ${(props) =>
|
50
31
|
props.theme.colors[props.hoveredBgColor]
|
@@ -66,21 +47,6 @@ export default {
|
|
66
47
|
colorMode: {
|
67
48
|
required: false,
|
68
49
|
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
|
84
50
|
}
|
85
51
|
},
|
86
52
|
|
@@ -91,12 +57,7 @@ export default {
|
|
91
57
|
},
|
92
58
|
methods: {
|
93
59
|
clickHandler() {
|
94
|
-
|
95
|
-
// prevent emitter if the option is disabled
|
96
|
-
return
|
97
|
-
} else {
|
98
|
-
this.$parent.$emit('option-selected', this.value)
|
99
|
-
}
|
60
|
+
this.$parent.$emit('option-selected', this.value)
|
100
61
|
},
|
101
62
|
hoverHandler() {
|
102
63
|
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,
|
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,13 +134,11 @@
|
|
134
134
|
{{ !!item[option] ? item[option] : '-' }}
|
135
135
|
</span>
|
136
136
|
<template-button
|
137
|
-
:key="idx"
|
138
137
|
@click.stop="onTemplateClick(item)"
|
139
138
|
v-else-if="option === 'template' && item.has_template"
|
140
139
|
>{{ $gettext('Use template...') }}</template-button
|
141
140
|
>
|
142
141
|
<no-template
|
143
|
-
:key="idx"
|
144
142
|
v-else-if="option === 'template' && !item.has_template"
|
145
143
|
>
|
146
144
|
{{ $gettext('No main component template') }}
|
@@ -91,11 +91,19 @@ export const stringToNumber = ({
|
|
91
91
|
return parseFloat(newVal)
|
92
92
|
}
|
93
93
|
|
94
|
-
export const numberToString = ({ value, numberPrecision
|
95
|
-
const minimumRounding = minDecimals ? minDecimals : 0
|
94
|
+
export const numberToString = ({ value, numberPrecision = 0 }) => {
|
96
95
|
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
|
+
}
|
97
105
|
return value.toLocaleString(langForLocaleString(), {
|
98
|
-
minimumFractionDigits:
|
99
|
-
maximumFractionDigits:
|
106
|
+
minimumFractionDigits: minNumberPrecision,
|
107
|
+
maximumFractionDigits: maxNumberPrecision
|
100
108
|
})
|
101
109
|
}
|
@@ -1,3 +0,0 @@
|
|
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>
|