@eturnity/eturnity_reusable_components 6.37.0-EPDM-8148.0 → 6.37.0-EPDM-8148.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "6.37.0-EPDM-8148.0",
3
+ "version": "6.37.0-EPDM-8148.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -60,7 +60,14 @@
60
60
  fontColor="black"
61
61
  :disabled="false"
62
62
  />
63
-
63
+ <icon
64
+ name="opacity"
65
+ color="red"
66
+ hoveredColor="blue"
67
+ size="60px"
68
+ cursor="default"
69
+ isStriked = "true"
70
+ />
64
71
  <Select
65
72
  :value="value"
66
73
  selectWidth="100%"
@@ -104,6 +111,7 @@ import Option from '@/components/inputs/select/option'
104
111
  import iconCollection from '@/components/icon/iconCollection'
105
112
  import dropdownComponent from '@/components/dropdown'
106
113
  import videoThumbnail from '@/components/videoThumbnail'
114
+ import icon from '@/components/icon'
107
115
  // import TableDropdown from "@/components/tableDropdown"
108
116
 
109
117
  const PageContainer = styled.div`
@@ -127,7 +135,8 @@ export default {
127
135
  SwitchField,
128
136
  iconCollection,
129
137
  dropdownComponent,
130
- videoThumbnail
138
+ videoThumbnail,
139
+ icon
131
140
  },
132
141
  data() {
133
142
  return {
@@ -1 +1 @@
1
- <svg class="svg-icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M753.493333 341.12L512 100.053333l-241.493333 241.066667C203.946667 407.68 170.666667 496.426667 170.666667 581.76s33.28 175.36 99.84 241.92a340.906667 340.906667 0 0 0 482.986666 0C820.053333 757.12 853.333333 667.093333 853.333333 581.76s-33.28-174.08-99.84-240.64zM256 597.333333c0.426667-85.333333 26.453333-139.733333 75.093333-187.946666L512 224.64l180.906667 186.666667C741.546667 459.733333 767.573333 512 768 597.333333H256z" /></svg>
1
+ <svg class="svg-icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M753.493333 341.12L512 100.053333l-241.493333 241.066667C203.946667 407.68 170.666667 496.426667 170.666667 581.76s33.28 175.36 99.84 241.92a340.906667 340.906667 0 0 0 482.986666 0C820.053333 757.12 853.333333 667.093333 853.333333 581.76s-33.28-174.08-99.84-240.64zM256 597.333333c0.426667-85.333333 26.453333-139.733333 75.093333-187.946666L512 224.64l180.906667 186.666667C741.546667 459.733333 767.573333 512 768 597.333333H256z" /></svg>
@@ -5,6 +5,7 @@
5
5
  :minWidth="minWidth"
6
6
  :isDisabled="isDisabled"
7
7
  :customColor="customColor"
8
+ :noWrap="noWrap"
8
9
  >
9
10
  {{ text }}
10
11
  </button-container>
@@ -26,7 +27,7 @@ import styled from "vue-styled-components"
26
27
 
27
28
  const PageContainer = styled.div``
28
29
 
29
- const ButtonAttrs = { type: String, isDisabled: Boolean, minWidth: String, customColor: String }
30
+ const ButtonAttrs = { type: String, isDisabled: Boolean, minWidth: String, customColor: String, noWrap: Boolean }
30
31
  const ButtonContainer = styled("div", ButtonAttrs)`
31
32
  padding: 7px 15px;
32
33
  font-size: 13px;
@@ -48,6 +49,7 @@ const ButtonContainer = styled("div", ButtonAttrs)`
48
49
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
49
50
  user-select: none;
50
51
  ${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
52
+ ${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
51
53
 
52
54
  &:hover {
53
55
  opacity: ${(props) => (props.isDisabled ? "1" : "0.8")};
@@ -80,6 +82,10 @@ export default {
80
82
  required: false,
81
83
  default: null,
82
84
  },
85
+ noWrap: {
86
+ required: false,
87
+ default: false
88
+ },
83
89
  minWidth: {
84
90
  required: false,
85
91
  default: null
@@ -9,6 +9,7 @@
9
9
  require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
10
10
  "
11
11
  ></icon-image>
12
+ <striked-line v-if="isStriked" :color="color" :disabled="disabled" :hoveredColor="hoveredColor"></striked-line>
12
13
  </Wrapper>
13
14
  </template>
14
15
 
@@ -21,6 +22,7 @@
21
22
  // hoveredColor="blue"
22
23
  // size="60px" by default, this is 30px
23
24
  // cursor="default"
25
+ // isStriked = "true"
24
26
  // />
25
27
 
26
28
  import styled from 'vue-styled-components'
@@ -28,6 +30,7 @@ import styled from 'vue-styled-components'
28
30
  const wrapperAttrs = { isDisabled: Boolean, size: String, cursor: String }
29
31
  const Wrapper = styled('div', wrapperAttrs)`
30
32
  display: flex;
33
+ position:relative
31
34
  align-content: center;
32
35
  justify-content: center;
33
36
  width: ${(props) => props.size};
@@ -37,6 +40,22 @@ const Wrapper = styled('div', wrapperAttrs)`
37
40
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : props.cursor)};
38
41
  line-height: 0;
39
42
  `
43
+ const strikedAttrs = { isDisabled: Boolean, color: String, hoveredColor: String }
44
+ const strikedLine = styled('div', strikedAttrs)`
45
+ display: flex;
46
+ position: absolute;
47
+ bottom:0;
48
+ left:0;
49
+ align-content: center;
50
+ justify-content: center;
51
+ width: 143%;
52
+ height:8%;
53
+ background-color: ${(props)=>props.theme.colors[props.color] || props.color};
54
+ min-height: 0;
55
+ line-height: 0;
56
+ transform-origin: 0% 100%;
57
+ transform: rotate(-45deg);
58
+ `
40
59
  const IconImageProps = { color: String, hoveredColor: String, size: String }
41
60
  const IconImage = styled('div', IconImageProps)`
42
61
  svg {
@@ -50,13 +69,17 @@ const IconImage = styled('div', IconImageProps)`
50
69
  &:hover > svg path {
51
70
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
52
71
  }
72
+ &:hover + div {
73
+ background-color: ${(props)=>props.hoveredColor};
74
+ }
53
75
  `
54
76
 
55
77
  export default {
56
78
  name: 'icon',
57
79
  components: {
58
80
  IconImage,
59
- Wrapper
81
+ Wrapper,
82
+ strikedLine
60
83
  },
61
84
  props: {
62
85
  disabled: {
@@ -79,6 +102,10 @@ export default {
79
102
  cursor: {
80
103
  required: false,
81
104
  default: null
105
+ },
106
+ isStriked: {
107
+ required: false,
108
+ default: false
82
109
  }
83
110
  },
84
111
  data() {
@@ -4,6 +4,8 @@
4
4
  :size="size"
5
5
  :backgroundColor="backgroundColor"
6
6
  :borderRadius="borderRadius"
7
+ :hasBorder="hasBorder"
8
+ :color="iconColor"
7
9
  :hoveredBackgroundColor="hoveredBackgroundColor"
8
10
  :isHovered="isHovered"
9
11
  >
@@ -11,7 +13,10 @@
11
13
  :size="iconSize"
12
14
  :name="name"
13
15
  :color="iconColor"
14
- :hoveredColor="hoveredIconColor" />
16
+ :hoveredColor="hoveredIconColor"
17
+ :isStriked="isStriked"
18
+ />
19
+
15
20
  <caret v-if="hasCaret">
16
21
  <iconWrapper :disabled="disabled"
17
22
  size="10px"
@@ -36,12 +41,13 @@
36
41
 
37
42
  import styled from 'vue-styled-components'
38
43
  import icon from '../icon'
39
- const wrapperAttrs = { isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
44
+ const wrapperAttrs = { color: String, isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String,hasBorder:Boolean }
40
45
  const Wrapper = styled('div', wrapperAttrs)`
41
46
  position:relative;
42
47
  display: inline-flex;
43
48
  width: ${(props) => props.size};
44
49
  height: ${(props) => props.size};
50
+ border: ${(props) => props.hasBorder? 'solid 1px '+props.theme.colors[props.color] || props.color : ""};
45
51
  justify-content:center;
46
52
  align-items:center;
47
53
  cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
@@ -84,6 +90,9 @@
84
90
  backgroundColor: {
85
91
  required: false,
86
92
  },
93
+ hasBorder: {
94
+ required: false,
95
+ },
87
96
  hoveredBackgroundColor: {
88
97
  required: false,
89
98
  default:"transparentWhite1"
@@ -102,11 +111,15 @@
102
111
  },
103
112
  borderRadius:{
104
113
  required:false,
105
- default:'6px'
114
+ default:'4px'
106
115
  },
107
116
  isHovered:{
108
117
  required:false,
109
118
  default:false
119
+ },
120
+ isStriked:{
121
+ required:false,
122
+ default:false
110
123
  }
111
124
  },
112
125
  data() {
@@ -311,7 +311,8 @@ export default {
311
311
  return {
312
312
  textInput: '',
313
313
  isFocused: false,
314
- warningIcon: warningIcon
314
+ warningIcon: warningIcon,
315
+ isBlurred: false
315
316
  }
316
317
  },
317
318
  props: {
@@ -457,7 +458,7 @@ export default {
457
458
  ? this.minNumber
458
459
  : event
459
460
  }
460
- if (!this.allowNegative) {
461
+ if (!this.allowNegative && typeof event === 'number') {
461
462
  event = Math.abs(event)
462
463
  }
463
464
  event = parseFloat(event)
@@ -488,7 +489,9 @@ export default {
488
489
  return num
489
490
  }
490
491
  })
491
- let evaluated = eval(formatted.join(''))
492
+ let evaluated
493
+ formatted = this.removeStringItemsAfterLastNumber(formatted)
494
+ evaluated = eval(formatted.join(' '))
492
495
  if (typeof evaluated === 'string') {
493
496
  evaluated = stringToNumber({
494
497
  value: evaluated,
@@ -499,7 +502,32 @@ export default {
499
502
  }
500
503
  return evaluated
501
504
  },
505
+ removeStringItemsAfterLastNumber(array) {
506
+ // fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
507
+ let lastNumberIndex = -1
508
+ // Find the index of the last number in the array
509
+ for (let i = array.length - 1; i >= 0; i--) {
510
+ if (typeof array[i] === 'number') {
511
+ lastNumberIndex = i
512
+ break
513
+ }
514
+ }
515
+ // if there are no numbers, return an empty array
516
+ if (lastNumberIndex === -1) {
517
+ return []
518
+ }
519
+ // Remove non-numeric items after the last number
520
+ if (lastNumberIndex !== -1) {
521
+ const newArray = array.slice(0, lastNumberIndex + 1)
522
+ return newArray
523
+ }
524
+ return array
525
+ },
502
526
  onInput(value) {
527
+ if (this.isBlurred) {
528
+ this.isBlurred = false
529
+ return
530
+ }
503
531
  if (value === '') {
504
532
  this.$emit('on-input', '')
505
533
  }
@@ -514,6 +542,8 @@ export default {
514
542
  },
515
543
  onInputBlur(e) {
516
544
  this.isFocused = false
545
+ // setting isBlurred so we don't trigger onInput as well
546
+ this.isBlurred = true
517
547
  let value = e.target.value
518
548
  let evaluatedInput = this.onEvaluateCode(value)
519
549
  this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
@@ -14,9 +14,11 @@
14
14
  labelFontColor || colorMode == 'dark' ? 'white' : 'eturnityGrey'
15
15
  "
16
16
  :fontSize="fontSize"
17
- >{{ label }} <optionalLabel v-if="labelOptional"> ({{ $gettext('Optional') }})</optionalLabel>
18
- </input-label
19
- >
17
+ >{{ label }}
18
+ <optionalLabel v-if="labelOptional">
19
+ ({{ $gettext('Optional') }})</optionalLabel
20
+ >
21
+ </input-label>
20
22
  <info-text
21
23
  v-if="infoTextMessage"
22
24
  :text="infoTextMessage"
@@ -30,6 +32,7 @@
30
32
  ref="select"
31
33
  @click="toggleDropdown"
32
34
  :selectHeight="selectHeight"
35
+ :selectMinHeight="selectMinHeight"
33
36
  :bgColor="
34
37
  buttonBgColor || colorMode == 'dark' ? 'transparentBlack1' : 'white'
35
38
  "
@@ -162,7 +165,6 @@ const InputLabel = styled('div', labelAttrs)`
162
165
  `
163
166
  const optionalLabel = styled.span`
164
167
  font-weight: 300;
165
-
166
168
  `
167
169
  const inputProps = { selectWidth: String, optionWidth: String }
168
170
  const Container = styled('div', inputProps)`
@@ -191,6 +193,7 @@ const selectButtonAttrs = {
191
193
  hasError: Boolean,
192
194
  disabled: Boolean,
193
195
  selectHeight: String,
196
+ selectMinHeight: String,
194
197
  isSearchBarVisible: Boolean,
195
198
  showBorder: Boolean
196
199
  }
@@ -198,11 +201,10 @@ const selectButton = styled('div', selectButtonAttrs)`
198
201
  position: relative;
199
202
  box-sizing: border-box;
200
203
  border-radius: 4px;
201
- padding: ${(props) =>
202
- props.isSearchBarVisible ? '0' : '0px 0px 0 15px'};
204
+ padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
203
205
  text-align: left;
204
206
  border-radius: 4px;
205
- min-height: 36px;
207
+ min-height: ${(props) => props.selectMinHeight};
206
208
  display: flex;
207
209
  align-items: center;
208
210
  max-height: ${(props) => props.selectHeight};
@@ -303,9 +305,14 @@ export default {
303
305
  default: null
304
306
  },
305
307
  selectHeight: {
308
+ type: String,
306
309
  required: false,
307
310
  default: null
308
311
  },
312
+ selectMinHeight: {
313
+ required: false,
314
+ default: '36px'
315
+ },
309
316
  optionWidth: {
310
317
  required: false,
311
318
  default: null
@@ -1,59 +1,94 @@
1
1
  <template>
2
- <optionContainer :data-value="value" :hoveredBgColor="hoveredBgColor || colorMode=='dark'?'#000000':'grey5'" @click="clickHandler" @mouseover="hoverHandler">
3
- <slot></slot>
4
- </optionContainer>
5
- </template>
2
+ <optionContainer
3
+ :data-value="value"
4
+ :hoveredBgColor="
5
+ colorMode == 'dark'
6
+ ? '#000000'
7
+ : hoveredBgColor
8
+ ? hoveredBgColor
9
+ : 'grey5'
10
+ "
11
+ @click="clickHandler"
12
+ @mouseover="hoverHandler"
13
+ :cursorType="cursorType"
14
+ :backgroundColor="colorMode == 'dark' ? '#000000' : backgroundColor"
15
+ :title="hoverText"
16
+ >
17
+ <slot></slot>
18
+ </optionContainer>
19
+ </template>
6
20
 
7
- <script>
21
+ <script>
8
22
  // import selectButton from './selectButton'
9
23
  // import selectDropdown from './selectDropDown'
10
- import styled from 'vue-styled-components'
11
- const optionProps={hoveredBgColor:String}
12
- const optionContainer = styled('div',optionProps)`
13
- display:flex;
14
- cursor: pointer;
15
- flex-direction: row;
16
- justify-content: space-between;
17
- align-items: center;
18
- padding: 12px 10px;
19
- gap: 14px;
20
- width:100%;
21
- box-sizing:inherit;
22
- &:hover{
23
- background-color:${(props) => props.theme.colors[props.hoveredBgColor]?props.theme.colors[props.hoveredBgColor]:props.hoveredBgColor};
24
- }
25
- `
24
+ import styled from 'vue-styled-components'
25
+ const optionProps = {
26
+ hoveredBgColor: String,
27
+ cursorType: String,
28
+ backgroundColor: String
29
+ }
30
+ const optionContainer = styled('div', optionProps)`
31
+ display: flex;
32
+ cursor: ${(props) => props.cursorType};
33
+ flex-direction: row;
34
+ justify-content: space-between;
35
+ align-items: center;
36
+ padding: 12px 10px;
37
+ gap: 14px;
38
+ width: 100%;
39
+ box-sizing: inherit;
40
+ background-color: ${(props) =>
41
+ props.theme.colors[props.backgroundColor]
42
+ ? props.theme.colors[props.backgroundColor]
43
+ : props.backgroundColor};
44
+ &:hover {
45
+ background-color: ${(props) =>
46
+ props.theme.colors[props.hoveredBgColor]
47
+ ? props.theme.colors[props.hoveredBgColor]
48
+ : props.hoveredBgColor};
49
+ }
50
+ `
26
51
 
27
- export default {
28
- name: 'RCoption',
52
+ export default {
53
+ name: 'RCoption',
29
54
 
30
- props: {
31
- value: {
32
- required: true
33
- },
34
- hoveredBgColor:{
35
- required:false,
36
- },
37
- colorMode:{
38
- required:false,
39
- default:'light'
40
- }
55
+ props: {
56
+ value: {
57
+ required: true
58
+ },
59
+ hoveredBgColor: {
60
+ required: false
61
+ },
62
+ colorMode: {
63
+ required: false,
64
+ default: 'light'
65
+ },
66
+ cursorType: {
67
+ required: false,
68
+ default: 'cursor'
41
69
  },
70
+ backgroundColor: {
71
+ required: false,
72
+ default: 'white'
73
+ },
74
+ hoverText: {
75
+ required: false
76
+ }
77
+ },
42
78
 
43
- components: {optionContainer},
79
+ components: { optionContainer },
44
80
 
45
- data() {
46
- return {}
81
+ data() {
82
+ return {}
83
+ },
84
+ methods: {
85
+ clickHandler() {
86
+ this.$parent.$emit('option-selected', this.value)
47
87
  },
48
- methods:{
49
- clickHandler(){
50
- this.$parent.$emit('option-selected',this.value)
51
- },
52
- hoverHandler(){
53
- this.$parent.$emit('option-hovered',this.value)
54
- }
55
- },
56
- computed: {
88
+ hoverHandler() {
89
+ this.$parent.$emit('option-hovered', this.value)
57
90
  }
58
- }
59
- </script>
91
+ },
92
+ computed: {}
93
+ }
94
+ </script>
@@ -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;
@@ -139,11 +139,13 @@
139
139
  {{ !!item[option] ? item[option] : '-' }}
140
140
  </span>
141
141
  <template-button
142
+ :key="idx"
142
143
  @click.stop="onTemplateClick(item)"
143
144
  v-else-if="option === 'template' && item.has_template"
144
145
  >{{ $gettext('Use template...') }}</template-button
145
146
  >
146
147
  <no-template
148
+ :key="idx"
147
149
  v-else-if="option === 'template' && !item.has_template"
148
150
  >
149
151
  {{ $gettext('No main component template') }}
@@ -20,9 +20,12 @@ export const stringToNumber = ({
20
20
  selectedLang === 'de-be' ||
21
21
  selectedLang === 'es-es' ||
22
22
  selectedLang === 'de' ||
23
+ selectedLang === 'de-at' ||
23
24
  selectedLang === 'it' ||
25
+ selectedLang === 'it-it' ||
24
26
  selectedLang === 'nl-nl' ||
25
- selectedLang === 'nl-be'
27
+ selectedLang === 'nl-be' ||
28
+ selectedLang === 'de-at'
26
29
  ) {
27
30
  // replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
28
31
  if (allowNegative) {
@@ -89,7 +92,8 @@ export const stringToNumber = ({
89
92
  return parseFloat(newVal)
90
93
  }
91
94
 
92
- export const numberToString = ({ value, numberPrecision }) => {
95
+ export const numberToString = ({ value, numberPrecision, minDecimals }) => {
96
+ const minimumRounding = minDecimals ? minDecimals : 0
93
97
  let selectedLang = localStorage.getItem('lang')
94
98
  ? localStorage.getItem('lang') === 'fr-lu'
95
99
  ? 'fr-fr'
@@ -100,7 +104,7 @@ export const numberToString = ({ value, numberPrecision }) => {
100
104
  }
101
105
  value = parseFloat(value)
102
106
  return value.toLocaleString(selectedLang, {
103
- minimumFractionDigits: numberPrecision,
107
+ minimumFractionDigits: minimumRounding, // removing this for now. Why do we need this to be a minimum amount?
104
108
  maximumFractionDigits: numberPrecision
105
109
  })
106
110
  }
@@ -8,6 +8,8 @@ export const translateLang = (lang) => {
8
8
  return 'english_uk'
9
9
  } else if (lang === 'de' || lang === 'de-de') {
10
10
  return 'german'
11
+ } else if (lang === 'de-at') {
12
+ return 'german_at'
11
13
  } else if (lang === 'de-ch') {
12
14
  return 'german_ch'
13
15
  } else if (lang === 'de-lu') {
@@ -34,8 +36,10 @@ export const translateLang = (lang) => {
34
36
  return 'swedish'
35
37
  } else if (lang === 'no-no' || lang === 'nb-no') {
36
38
  return 'norwegian'
37
- } else if (lang === 'nl-nl' || lang === 'nl') {
38
- return 'nl-nl'
39
+ } else if (lang === 'nl-nl') {
40
+ return 'dutch_nl'
41
+ } else if (lang === 'nl-be') {
42
+ return 'dutch_be'
39
43
  } else if (lang === 'cs') {
40
44
  return 'czech'
41
45
  } else if (lang === 'fi-fi') {