@eturnity/eturnity_reusable_components 1.2.19-EPDM-5262.5 → 1.2.19-EPDM-5262.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.19-EPDM-5262.5",
3
+ "version": "1.2.19-EPDM-5262.6",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -101,7 +101,7 @@ export default {
101
101
  number_format_precision: 4,
102
102
  number_min_allowed: 0,
103
103
  number_max_allowed: 10,
104
- unit_short_name: 'cm'
104
+ unit_short_name: 'cm',
105
105
  },
106
106
  dropdownOpen: false,
107
107
  isChecked: false,
@@ -109,47 +109,47 @@ export default {
109
109
  {
110
110
  name: 'Option 1',
111
111
  value: 'option_1',
112
- disabled: true
112
+ disabled: true,
113
113
  },
114
114
  {
115
115
  name: 'Option 2',
116
- value: 'option_2'
116
+ value: 'option_2',
117
117
  },
118
118
  {
119
119
  name: 'Option 3',
120
- value: 'option_3'
120
+ value: 'option_3',
121
121
  },
122
122
  {
123
123
  name: 'Option 4',
124
- value: 'option_4'
125
- }
124
+ value: 'option_4',
125
+ },
126
126
  ],
127
127
  itemOptions: [
128
128
  {
129
129
  display_name: 'Test 1',
130
130
  company_item_number: '123',
131
131
  model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
132
- id: 1
132
+ id: 1,
133
133
  },
134
134
  {
135
135
  display_name: 'Test 2',
136
136
  company_item_number: '1234',
137
137
  model: 'BTB-123',
138
- id: 2
138
+ id: 2,
139
139
  },
140
140
  {
141
141
  display_name: 'Test 3',
142
142
  company_item_number: '12345',
143
143
  model: 'BTB-543',
144
- id: 3
144
+ id: 3,
145
145
  },
146
146
  {
147
147
  display_name: 'Test 4',
148
148
  company_item_number: '123456',
149
149
  model: 'BTB-4930',
150
- id: 4
151
- }
152
- ]
150
+ id: 4,
151
+ },
152
+ ],
153
153
  }
154
154
  },
155
155
  methods: {
@@ -174,21 +174,21 @@ export default {
174
174
  {
175
175
  value: this.getComponentInfo({
176
176
  row: this.itemOptions[0],
177
- value: 'display_name'
178
- })
177
+ value: 'display_name',
178
+ }),
179
179
  },
180
180
  {
181
181
  value: this.getComponentInfo({
182
182
  row: this.itemOptions[0],
183
- value: 'company_item_number'
184
- })
183
+ value: 'company_item_number',
184
+ }),
185
185
  },
186
186
  {
187
187
  value: this.getComponentInfo({
188
188
  row: this.itemOptions[0],
189
- value: 'model'
190
- })
191
- }
189
+ value: 'model',
190
+ }),
191
+ },
192
192
  ]
193
193
  return items
194
194
  },
@@ -202,8 +202,8 @@ export default {
202
202
  item = '-'
203
203
  }
204
204
  return item
205
- }
206
- }
205
+ },
206
+ },
207
207
  }
208
208
  </script>
209
209
 
@@ -1,34 +1,34 @@
1
1
  const theme = {
2
2
  colors: {
3
- primary: "#48a2d0",
4
- secondary: "#fdb813",
5
- tertiary: "#d5d5d5",
6
- black: "#353535",
7
- yellow: "#fdb813",
8
- darkGray: "#818181",
9
- gray1: "#666",
10
- mediumGray: "#d5d5d5",
11
- lightGray: "#f2f2f2",
12
- white: "#fff",
13
- blue: "#48a2d0",
14
- red: "#ff5656",
15
- blue1: "#e4efff",
16
- grey1: "#666",
17
- grey2: "#c4c4c4",
18
- grey3: "#b2b9c5",
19
- grey4: "#ebeef4",
20
- grey5: "#fafafa",
21
- green: "#99db0c",
22
- disabled: "#dfe1e1",
3
+ primary: '#48a2d0',
4
+ secondary: '#fdb813',
5
+ tertiary: '#d5d5d5',
6
+ black: '#353535',
7
+ yellow: '#fdb813',
8
+ darkGray: '#818181',
9
+ gray1: '#666',
10
+ mediumGray: '#d5d5d5',
11
+ lightGray: '#f2f2f2',
12
+ white: '#fff',
13
+ blue: '#48a2d0',
14
+ red: '#ff5656',
15
+ blue1: '#e4efff',
16
+ grey1: '#666',
17
+ grey2: '#c4c4c4',
18
+ grey3: '#b2b9c5',
19
+ grey4: '#dee2eb',
20
+ grey5: '#fafafa',
21
+ green: '#99db0c',
22
+ disabled: '#dfe1e1'
23
23
  },
24
24
  screen: {
25
- mobileSmall: "345px",
26
- mobile: "425px",
27
- mobileLarge: "530px",
28
- tablet: "768px",
29
- tabletLarge: "950px",
25
+ mobileSmall: '345px',
26
+ mobile: '425px',
27
+ mobileLarge: '530px',
28
+ tablet: '768px',
29
+ tabletLarge: '950px'
30
30
  },
31
- borderRadius: "4px",
31
+ borderRadius: '4px'
32
32
  }
33
33
 
34
34
  export default theme
@@ -37,7 +37,8 @@ const IconImage = styled('div', IconImageProps)`
37
37
  height: ${(props) => props.size};
38
38
  }
39
39
  svg > path {
40
- ${(props) => props.color && `fill: ${props.color};`}
40
+ ${(props) =>
41
+ props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
41
42
  }
42
43
  &:hover > svg > path {
43
44
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
@@ -33,7 +33,7 @@
33
33
  // backgroundColor="red"
34
34
  // :isDisabled="true"
35
35
  // />
36
- import styled from "vue-styled-components"
36
+ import styled from 'vue-styled-components'
37
37
 
38
38
  const ComponentWrapper = styled.div`
39
39
  min-height: 18px;
@@ -45,34 +45,33 @@ const containerAttrs = {
45
45
  hasLabel: Boolean,
46
46
  backgroundColor: String,
47
47
  isChecked: Boolean,
48
- isDisabled: Boolean,
48
+ isDisabled: Boolean
49
49
  }
50
- const Container = styled("label", containerAttrs)`
50
+ const Container = styled('label', containerAttrs)`
51
51
  display: grid;
52
- grid-template-columns: ${(props) => (props.hasLabel ? "18px auto" : "18px")};
52
+ grid-template-columns: ${(props) => (props.hasLabel ? '18px auto' : '18px')};
53
53
  grid-gap: 16px;
54
54
  align-content: center;
55
- /* align-items: center; */
56
55
  color: ${(props) => props.theme.colors.black};
57
56
  position: relative;
58
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
57
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
59
58
  font-size: 16px;
60
59
  user-select: none;
61
60
 
62
61
  .checkmark {
63
62
  position: absolute;
64
63
  height: ${(props) =>
65
- props.size === "medium"
66
- ? "25px"
67
- : props.size === "small"
68
- ? "16px"
69
- : "25px"};
64
+ props.size === 'medium'
65
+ ? '25px'
66
+ : props.size === 'small'
67
+ ? '16px'
68
+ : '25px'};
70
69
  width: ${(props) =>
71
- props.size === "medium"
72
- ? "25px"
73
- : props.size === "small"
74
- ? "16px"
75
- : "25px"};
70
+ props.size === 'medium'
71
+ ? '25px'
72
+ : props.size === 'small'
73
+ ? '16px'
74
+ : '25px'};
76
75
  background-color: ${(props) =>
77
76
  props.isChecked
78
77
  ? props.backgroundColor
@@ -80,7 +79,7 @@ const Container = styled("label", containerAttrs)`
80
79
  : props.theme.colors.green
81
80
  : props.isDisabled
82
81
  ? props.theme.colors.lightGray
83
- : "#fff"};
82
+ : '#fff'};
84
83
  border-radius: 4px;
85
84
  border: 1px solid
86
85
  ${(props) =>
@@ -91,34 +90,34 @@ const Container = styled("label", containerAttrs)`
91
90
  : props.theme.colors.mediumGray};
92
91
 
93
92
  &:after {
94
- content: "";
93
+ content: '';
95
94
  position: absolute;
96
- display: ${(props) => (props.isChecked ? "block" : "none")};
95
+ display: ${(props) => (props.isChecked ? 'block' : 'none')};
97
96
  }
98
97
  }
99
98
 
100
99
  .checkmark:after {
101
100
  left: ${(props) =>
102
- props.size === "medium" ? "9px" : props.size === "small" ? "5px" : "9px"};
101
+ props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
103
102
  top: ${(props) =>
104
- props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
103
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
105
104
  width: ${(props) =>
106
- props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
105
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
107
106
  height: ${(props) =>
108
- props.size === "medium"
109
- ? "10px"
110
- : props.size === "small"
111
- ? "6px"
112
- : "10px"};
107
+ props.size === 'medium'
108
+ ? '10px'
109
+ : props.size === 'small'
110
+ ? '6px'
111
+ : '10px'};
113
112
  border: solid
114
113
  ${(props) =>
115
114
  props.checkColor ? props.checkColor : props.theme.colors.white};
116
115
  border-width: ${(props) =>
117
- props.size === "medium"
118
- ? "0 3px 3px 0"
119
- : props.size === "small"
120
- ? "0 2px 2px 0"
121
- : "0 3px 3px 0"};
116
+ props.size === 'medium'
117
+ ? '0 3px 3px 0'
118
+ : props.size === 'small'
119
+ ? '0 2px 2px 0'
120
+ : '0 3px 3px 0'};
122
121
  transform: rotate(45deg);
123
122
  }
124
123
  `
@@ -135,49 +134,49 @@ const InputCheckbox = styled.input`
135
134
  const LabelText = styled.div`
136
135
  font-size: 13px;
137
136
  display: grid;
138
- align-items: center;
137
+ align-items: flex-start;
139
138
  min-height: 18px;
140
139
  `
141
140
 
142
141
  export default {
143
- name: "checkbox",
142
+ name: 'checkbox',
144
143
  components: {
145
144
  ComponentWrapper,
146
145
  Container,
147
146
  InputCheckbox,
148
- LabelText,
147
+ LabelText
149
148
  },
150
149
  props: {
151
150
  label: {
152
151
  required: false,
153
- default: "",
152
+ default: ''
154
153
  },
155
154
  isChecked: {
156
155
  required: true,
157
- default: false,
156
+ default: false
158
157
  },
159
158
  checkColor: {
160
- required: false,
159
+ required: false
161
160
  },
162
161
  size: {
163
162
  required: false,
164
- default: "medium", // small, medium
163
+ default: 'medium' // small, medium
165
164
  },
166
165
  backgroundColor: {
167
- required: false,
166
+ required: false
168
167
  },
169
168
  isDisabled: {
170
169
  required: false,
171
- default: false,
172
- },
170
+ default: false
171
+ }
173
172
  },
174
173
  methods: {
175
174
  onChangeHandler(value) {
176
175
  if (this.isDisabled) {
177
176
  return
178
177
  }
179
- this.$emit("on-event-handler", value)
180
- },
181
- },
178
+ this.$emit('on-event-handler', value)
179
+ }
180
+ }
182
181
  }
183
182
  </script>
@@ -351,10 +351,12 @@ export default {
351
351
  }
352
352
  })
353
353
  let evaluated = eval(formatted.join(''))
354
- evaluated = stringToNumber({
355
- value: evaluated,
356
- numberPrecision: this.numberPrecision
357
- })
354
+ if (typeof evaluated === 'string') {
355
+ evaluated = stringToNumber({
356
+ value: evaluated,
357
+ numberPrecision: this.numberPrecision
358
+ })
359
+ }
358
360
  return evaluated
359
361
  },
360
362
  onInputBlur(e) {
@@ -3,15 +3,18 @@
3
3
  :isOpen="isOpen"
4
4
  :class="{ visible: isOpen, hidden: !isOpen }"
5
5
  @click.native="onOutsideClose()"
6
+ :backdrop="backdrop"
6
7
  >
7
8
  <modal-container @click.stop>
8
- <spinner v-if="isLoading" size="50px" :fullWidth="true" />
9
+ <spinner v-if="isLoading" size="50px" :limitedToModal="true" />
10
+ <content-container :visible="!isLoading">
11
+ <slot />
12
+ </content-container>
9
13
  <close-button
10
14
  v-if="!hideClose"
11
15
  @click.native="onCloseModal()"
12
16
  class="close"
13
17
  />
14
- <slot />
15
18
  </modal-container>
16
19
  </page-wrapper>
17
20
  </template>
@@ -28,7 +31,12 @@ import styled from 'vue-styled-components'
28
31
  import CloseButton from '../../buttons/closeButton'
29
32
  import Spinner from '../../spinner'
30
33
 
31
- const pageAttrs = { isOpen: Boolean }
34
+ const contentAttrs = { visible: Boolean }
35
+ const ContentContainer = styled('div', contentAttrs)`
36
+ visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
37
+ `
38
+
39
+ const pageAttrs = { isOpen: Boolean, backdrop: String }
32
40
  const PageWrapper = styled('div', pageAttrs)`
33
41
  position: fixed;
34
42
  display: grid;
@@ -36,7 +44,10 @@ const PageWrapper = styled('div', pageAttrs)`
36
44
  left: 0;
37
45
  width: 100%;
38
46
  height: 100%;
39
- background-color: rgba(255, 255, 255, 0.9);
47
+ background-color: ${(props) =>
48
+ props.backdrop == 'dark'
49
+ ? 'rgba(0, 0, 0, 0.4)'
50
+ : 'rgba(255, 255, 255, 0.9)'};
40
51
  z-index: 99999;
41
52
  overflow: auto;
42
53
 
@@ -98,7 +109,8 @@ export default {
98
109
  PageWrapper,
99
110
  ModalContainer,
100
111
  CloseButton,
101
- Spinner
112
+ Spinner,
113
+ ContentContainer
102
114
  },
103
115
  props: {
104
116
  isOpen: {
@@ -116,6 +128,10 @@ export default {
116
128
  hideClose: {
117
129
  required: false,
118
130
  default: false
131
+ },
132
+ backdrop: {
133
+ required: false,
134
+ default: 'white'
119
135
  }
120
136
  },
121
137
  methods: {
@@ -135,4 +151,4 @@ export default {
135
151
  }
136
152
  }
137
153
  }
138
- </script>
154
+ </script>
@@ -26,5 +26,6 @@ export const Default = Template.bind({
26
26
  preventOutsideClose: true,
27
27
  isLoading: false,
28
28
  hideClose: false,
29
- });
29
+ backdrop: 'dark',
30
+ })
30
31
  Default.args = {};
@@ -7,7 +7,7 @@
7
7
  />
8
8
  </container>
9
9
  </spinner-container>
10
- <container v-else>
10
+ <container v-else :limitedToModal="limitedToModal">
11
11
  <spinner-wrapper
12
12
  :size="size"
13
13
  :src="require('../../assets/icons/black_spinner.svg')"
@@ -18,7 +18,7 @@
18
18
  <script>
19
19
  // import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
20
20
  // <spinner size="30px" />
21
- import styled from "vue-styled-components"
21
+ import styled from 'vue-styled-components'
22
22
 
23
23
  const SpinnerContainer = styled.div`
24
24
  position: fixed;
@@ -32,34 +32,41 @@ const SpinnerContainer = styled.div`
32
32
  justify-items: center;
33
33
  z-index: 100;
34
34
  `
35
-
36
- const Container = styled.div`
35
+ const containerAttrs = { limitedToModal: Boolean }
36
+ const Container = styled('div', containerAttrs)`
37
37
  display: grid;
38
38
  align-items: center;
39
39
  justify-items: center;
40
+ position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
41
+ height: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
42
+ width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
40
43
  `
41
44
 
42
45
  const spinnerAttrs = { size: String }
43
- const SpinnerWrapper = styled("img", spinnerAttrs)`
44
- width: ${(props) => (props.size ? props.size : "60px")};
46
+ const SpinnerWrapper = styled('img', spinnerAttrs)`
47
+ width: ${(props) => (props.size ? props.size : '60px')};
45
48
  `
46
49
 
47
50
  export default {
48
- name: "spinner",
51
+ name: 'spinner',
49
52
  components: {
50
53
  Container,
51
54
  SpinnerWrapper,
52
- SpinnerContainer,
55
+ SpinnerContainer
53
56
  },
54
57
  props: {
55
58
  fullWidth: {
56
59
  required: false,
57
- default: false,
60
+ default: false
58
61
  },
59
- size: {
62
+ limitedToModal: {
60
63
  required: false,
61
- default: null,
64
+ default: false
62
65
  },
63
- },
66
+ size: {
67
+ required: false,
68
+ default: null
69
+ }
70
+ }
64
71
  }
65
- </script>
72
+ </script>
@@ -12,12 +12,16 @@ export const stringToNumber = ({
12
12
  // The first replace will replace not allowed characters with a blank
13
13
  if (
14
14
  selectedLang === 'de-DE' ||
15
+ selectedLang === 'de-de' ||
15
16
  selectedLang === 'no-no' ||
16
17
  selectedLang === 'da-dk' ||
17
18
  selectedLang === 'de-lu' ||
18
19
  selectedLang === 'de-be' ||
19
20
  selectedLang === 'es-es' ||
20
- selectedLang === 'de'
21
+ selectedLang === 'de' ||
22
+ selectedLang === 'it' ||
23
+ selectedLang === 'nl-nl' ||
24
+ selectedLang === 'nl-be'
21
25
  ) {
22
26
  // replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
23
27
  if (allowNegative) {
@@ -45,9 +49,15 @@ export const stringToNumber = ({
45
49
  ) {
46
50
  // replace ' with blank: 1'234.56 --> 1234.56
47
51
  if (allowNegative) {
48
- newVal = newVal.replace(/[^\d-.,']/g, '').replace(/['\s]/g, '')
52
+ newVal = newVal
53
+ .replace(/[^\d-.,']/g, '')
54
+ .replace(/[,\s]/, '')
55
+ .replace(/['\s]/g, '')
49
56
  } else {
50
- newVal = newVal.replace(/[^\d.,']/g, '').replace(/['\s]/g, '')
57
+ newVal = newVal
58
+ .replace(/[^\d.,']/g, '')
59
+ .replace(/[,\s]/, '')
60
+ .replace(/['\s]/g, '')
51
61
  }
52
62
  } else if (
53
63
  selectedLang === 'fr-fr' ||