@eturnity/eturnity_reusable_components 6.37.0-EPDM-8148.7 → 6.37.0-EPDM-2198.1

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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/src/App.vue +42 -181
  3. package/src/assets/svgIcons/charger_icon_white.svg +44 -0
  4. package/src/assets/svgIcons/collections.svg +3 -0
  5. package/src/assets/svgIcons/dashboard.svg +3 -0
  6. package/src/assets/svgIcons/energy_meter.svg +12 -0
  7. package/src/assets/svgIcons/erase.svg +1 -1
  8. package/src/assets/svgIcons/expand.svg +1 -0
  9. package/src/assets/svgIcons/logout.svg +3 -0
  10. package/src/assets/svgIcons/split.svg +94 -0
  11. package/src/assets/svgIcons/subscriptions.svg +3 -0
  12. package/src/assets/theme.js +3 -0
  13. package/src/components/addNewButton/index.vue +12 -8
  14. package/src/components/buttons/mainButton/index.vue +35 -23
  15. package/src/components/card/index.vue +95 -0
  16. package/src/components/draggableInputHandle/index.vue +47 -0
  17. package/src/components/errorMessage/index.vue +1 -3
  18. package/src/components/filter/filterSettings.vue +15 -10
  19. package/src/components/filter/index.vue +12 -1
  20. package/src/components/icon/iconCollection.vue +5 -5
  21. package/src/components/icon/index.vue +10 -2
  22. package/src/components/iconWrapper/index.vue +17 -12
  23. package/src/components/infoCard/index.vue +36 -0
  24. package/src/components/infoText/index.vue +2 -12
  25. package/src/components/inputs/checkbox/index.vue +5 -0
  26. package/src/components/inputs/inputNumber/index.vue +48 -17
  27. package/src/components/inputs/inputText/index.vue +24 -5
  28. package/src/components/inputs/radioButton/index.vue +66 -49
  29. package/src/components/inputs/searchInput/index.vue +6 -0
  30. package/src/components/inputs/select/index.vue +122 -58
  31. package/src/components/inputs/select/option/index.vue +5 -1
  32. package/src/components/inputs/switchField/index.vue +7 -11
  33. package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +0 -8
  34. package/src/components/inputs/textAreaInput/index.vue +12 -7
  35. package/src/components/inputs/toggle/index.vue +82 -82
  36. package/src/components/label/index.vue +103 -0
  37. package/src/components/modals/modal/index.vue +46 -13
  38. package/src/components/navigationTabs/index.vue +105 -0
  39. package/src/components/pageSubtitle/index.vue +1 -8
  40. package/src/components/pageTitle/index.vue +32 -4
  41. package/src/components/pagination/index.vue +136 -129
  42. package/src/components/projectMarker/index.vue +39 -33
  43. package/src/components/sideMenu/index.vue +270 -0
  44. package/src/components/tables/mainTable/index.vue +3 -3
  45. package/src/components/threeDots/index.vue +31 -22
  46. package/src/helpers/numberConverter.js +4 -2
  47. package/src/helpers/translateLang.js +9 -1
@@ -1,16 +1,15 @@
1
1
  <template>
2
- <page-container :withDate="!!date">
2
+ <page-container>
3
3
  <marker-container
4
4
  v-if="markerData"
5
+ :hasBorderRadius="hasBorderRadius"
6
+ :withDate="!!date"
5
7
  :backgroundColor="markerData.color"
6
8
  :hasIcon="!!iconName"
7
9
  :isEditionAllowed="editionAllowed"
8
10
  :isActive="activated"
9
11
  :cursor="cursor"
10
- @click.native="editionAllowed
11
- ? activated = !activated
12
- : ''
13
- "
12
+ @click.native="editionAllowed ? (activated = !activated) : ''"
14
13
  >
15
14
  <icon
16
15
  v-if="!!iconName"
@@ -20,10 +19,7 @@
20
19
  :cursor="cursor"
21
20
  />
22
21
  <span>{{ markerData.translations[activeLanguage].name }}</span>
23
- <dot-wrapper
24
- v-if="editionAllowed"
25
- class="dotContainer"
26
- >
22
+ <dot-wrapper v-if="editionAllowed" class="dotContainer">
27
23
  <dot-icon />
28
24
  <dot-icon />
29
25
  <dot-icon />
@@ -38,10 +34,7 @@
38
34
  </edit-item>
39
35
  <edit-item @click.native="onEditClick">
40
36
  <icon-container>
41
- <icon
42
- name="edit_button"
43
- size="14px"
44
- />
37
+ <icon name="edit_button" size="14px" />
45
38
  </icon-container>
46
39
  <div>{{ $gettext('Edit') }}</div>
47
40
  </edit-item>
@@ -59,10 +52,7 @@
59
52
  <page-title :text="$gettext('delete_confirm_text')" />
60
53
  <page-subtitle :text="$gettext('delete_confirm_subtext')" />
61
54
  <cta-container>
62
- <main-button
63
- @click.native="onDelete"
64
- :text="$gettext('Delete')"
65
- />
55
+ <main-button @click.native="onDelete" :text="$gettext('Delete')" />
66
56
  <main-button
67
57
  type="cancel"
68
58
  @click.native="closeDeleteModal"
@@ -88,21 +78,17 @@
88
78
  // @deleteHandler="onMarkerDelete($event)"
89
79
  // />
90
80
 
91
- import styled from "vue-styled-components"
92
- import Icon from "../icon"
81
+ import styled from 'vue-styled-components'
82
+ import Icon from '../icon'
93
83
  import Modal from '../modals/modal'
94
84
  import PageTitle from '../pageTitle'
95
85
  import DeleteIcon from '../deleteIcon'
96
86
  import PageSubtitle from '../pageSubtitle'
97
87
  import MainButton from '../buttons/mainButton'
98
88
 
99
- const PageContainerAttrs = {
100
- withDate: Boolean
101
- }
102
- const PageContainer = styled('div', PageContainerAttrs)`
89
+ const PageContainer = styled.div`
103
90
  display: flex;
104
91
  align-items: center;
105
- gap: 10px;
106
92
  font-size: 12px;
107
93
  line-height: 14px;
108
94
  `
@@ -119,7 +105,9 @@ const CtaContainer = styled.div`
119
105
  `
120
106
 
121
107
  const MarkerAttrs = {
108
+ hasBorderRadius: Boolean,
122
109
  backgroundColor: String,
110
+ withDate: Boolean,
123
111
  hasIcon: Boolean,
124
112
  isEditionAllowed: Boolean,
125
113
  isActive: Boolean,
@@ -128,17 +116,22 @@ const MarkerAttrs = {
128
116
  const MarkerContainer = styled('div', MarkerAttrs)`
129
117
  display: grid;
130
118
  grid-template-columns: ${(props) =>
131
- props.hasIcon || props.isEditionAllowed ? 'auto 1fr' : '1fr'};
119
+ props.hasIcon || props.isEditionAllowed ? 'auto 1fr' : '1fr'};
132
120
  grid-gap: 5px;
133
121
  position: relative;
134
122
  align-items: center;
135
123
  padding: 2px 7px;
136
124
  color: ${(props) => props.theme.colors.white};
137
125
  background-color: ${(props) =>
138
- props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
139
- border-radius: 4px;
126
+ props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
127
+ border: 1px solid
128
+ ${(props) =>
129
+ props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
130
+ border-radius: ${(props) =>
131
+ props.hasBorderRadius ? (props.withDate ? '4px 0 0 4px' : '4px') : '0'};
132
+
140
133
  white-space: nowrap;
141
- cursor: ${(props) => props.isEditionAllowed ? 'pointer' : props.cursor};
134
+ cursor: ${(props) => (props.isEditionAllowed ? 'pointer' : props.cursor)};
142
135
 
143
136
  .dotContainer {
144
137
  display: ${(props) => (props.isActive ? 'flex' : 'none')};
@@ -194,10 +187,15 @@ const IconContainer = styled.div`
194
187
  line-height: 0;
195
188
  `
196
189
 
197
- const Date = styled.div``
190
+ const Date = styled.div`
191
+ padding: 2px 5px;
192
+ border: 1px solid ${(props) => props.theme.colors.grey4};
193
+ border-left: none;
194
+ border-radius: 0 4px 4px 0;
195
+ `
198
196
 
199
197
  export default {
200
- name: "project-marker",
198
+ name: 'project-marker',
201
199
  components: {
202
200
  PageContainer,
203
201
  MarkerContainer,
@@ -242,6 +240,10 @@ export default {
242
240
  cursor: {
243
241
  required: false,
244
242
  default: 'default'
243
+ },
244
+ hasBorderRadius: {
245
+ required: false,
246
+ default: true
245
247
  }
246
248
  },
247
249
  data() {
@@ -252,7 +254,11 @@ export default {
252
254
  },
253
255
  computed: {
254
256
  editionAllowed() {
255
- return (this.markerData.can_be_deleted && (!this.isLimitedPartner || this.isGroupSupport)) && this.isEditable
257
+ return (
258
+ this.markerData.can_be_deleted &&
259
+ (!this.isLimitedPartner || this.isGroupSupport) &&
260
+ this.isEditable
261
+ )
256
262
  },
257
263
  iconName() {
258
264
  if (this.markerData.choice === 'sold') {
@@ -274,11 +280,11 @@ export default {
274
280
  this.deleteModalOpened = false
275
281
  },
276
282
  onEditClick() {
277
- this.$emit("editHandler")
283
+ this.$emit('editHandler')
278
284
  },
279
285
  onDelete() {
280
286
  this.closeDeleteModal()
281
- this.$emit("deleteHandler")
287
+ this.$emit('deleteHandler')
282
288
  }
283
289
  }
284
290
  }
@@ -0,0 +1,270 @@
1
+ <template>
2
+ <page-container :isLoading="!tabsData.length">
3
+ <spinner-container v-if="!tabsData.length">
4
+ <spinner />
5
+ </spinner-container>
6
+ <list-container v-else>
7
+ <template v-for="(item, idx) in tabsData">
8
+ <list-item
9
+ v-if="!item.children"
10
+ :key="idx"
11
+ :data-id="`sub_menu_settings_${item.key}`"
12
+ :isActive="activeTab === item.key"
13
+ @click="$emit('tab-click', { activeKey: item.key })"
14
+ >
15
+ <icon-container :isActive="activeTab === item.key">
16
+ <icon :name="item.icon" color="#fff" cursor="pointer" size="18px" />
17
+ </icon-container>
18
+ <list-text>{{ $gettext(item.label) }}</list-text>
19
+ </list-item>
20
+ <collapse-wrapper v-else :key="idx + item.key">
21
+ <collapse-container
22
+ :data-id="`sub_menu_settings_${item.key}`"
23
+ @click="toggleActiveDropdown(item.key)"
24
+ >
25
+ <icon-container :isActive="activeParentTab === item.key">
26
+ <icon
27
+ :name="item.icon"
28
+ color="#fff"
29
+ cursor="pointer"
30
+ size="18px"
31
+ />
32
+ </icon-container>
33
+ <list-text>{{ $gettext(item.label) }}</list-text>
34
+ <arrow-container>
35
+ <icon
36
+ :name="activeDropdown === item.key ? 'arrow_up' : 'arrow_down'"
37
+ color="white"
38
+ size="10px"
39
+ />
40
+ </arrow-container>
41
+ </collapse-container>
42
+ <template v-if="activeDropdown === item.key">
43
+ <sub-router
44
+ v-for="subItem in item.children"
45
+ :key="subItem.key"
46
+ :isActive="activeTab === subItem.key"
47
+ :data-id="`sub_menu_settings_${subItem.key}`"
48
+ @click="
49
+ $emit('tab-click', {
50
+ activeKey: subItem.key,
51
+ parentKey: item.key
52
+ })
53
+ "
54
+ >
55
+ {{ $gettext(subItem.label) }}
56
+ </sub-router>
57
+ </template>
58
+ </collapse-wrapper>
59
+ </template>
60
+ </list-container>
61
+ <bottom-section v-if="hasLogout">
62
+ <icon-container
63
+ :isActive="false"
64
+ :isButton="true"
65
+ data-id="button_settings_logout"
66
+ @click="$emit('on-logout')"
67
+ >
68
+ <rotate-icon
69
+ name="initial_situation"
70
+ color="#fff"
71
+ cursor="pointer"
72
+ size="18px"
73
+ />
74
+ </icon-container>
75
+ <app-version>{{ appVersion }}</app-version>
76
+ </bottom-section>
77
+ </page-container>
78
+ </template>
79
+
80
+ <script>
81
+ import styled from 'vue-styled-components'
82
+ import Icon from '../icon'
83
+ import Spinner from '../spinner'
84
+
85
+ const PageAttrs = { isLoading: Boolean }
86
+ const PageContainer = styled('div', PageAttrs)`
87
+ background-color: ${(props) =>
88
+ props.isLoading ? props.theme.colors.white : props.theme.colors.grey6};
89
+ padding: 14px 12px;
90
+ min-width: 220px;
91
+ display: flex;
92
+ flex-direction: column;
93
+ justify-content: space-between;
94
+ `
95
+
96
+ const ListContainer = styled.div`
97
+ display: grid;
98
+ grid-gap: 6px;
99
+ `
100
+
101
+ const IconAttrs = { isActive: Boolean, isButton: Boolean }
102
+
103
+ const ListItem = styled('div', IconAttrs)`
104
+ display: grid;
105
+ align-items: center;
106
+ grid-template-columns: auto 1fr;
107
+ grid-gap: 20px;
108
+ cursor: pointer;
109
+ padding: 4px;
110
+ border-radius: 6px;
111
+ background-color: ${(props) =>
112
+ props.isActive ? 'rgba(255, 255, 255, 0.1)' : ''};
113
+
114
+ :hover {
115
+ background-color: rgba(255, 255, 255, 0.1);
116
+ }
117
+ `
118
+
119
+ const ListText = styled.div`
120
+ font-size: 16px;
121
+ font-weight: 700;
122
+ color: ${(props) => props.theme.colors.white};
123
+ `
124
+
125
+ const IconContainer = styled('div', IconAttrs)`
126
+ display: grid;
127
+ align-items: center;
128
+ justify-items: center;
129
+ width: 32px;
130
+ height: 32px;
131
+ background-color: ${(props) =>
132
+ props.isActive ? props.theme.colors.red : 'rgba(255, 255, 255, 0.2)'};
133
+ border-radius: 6px;
134
+
135
+ ${({ isButton = false }) =>
136
+ isButton &&
137
+ `
138
+ cursor: pointer;
139
+ &:hover {
140
+ background-color: rgba(255, 255, 255, 0.3);
141
+ }
142
+ `}
143
+ `
144
+
145
+ const SpinnerContainer = styled.div`
146
+ margin-top: 30px;
147
+ `
148
+
149
+ const BottomSection = styled.div`
150
+ display: flex;
151
+ justify-content: space-between;
152
+ align-items: center;
153
+ `
154
+
155
+ const RotateIcon = styled(Icon)`
156
+ transform: rotate(-90deg);
157
+ `
158
+
159
+ const AppVersion = styled.p`
160
+ font-size: 11px;
161
+ line-height: 13px;
162
+ color: ${(props) => props.theme.colors.white};
163
+ margin-right: 6px;
164
+ `
165
+
166
+ const SubRouter = styled('div', IconAttrs)`
167
+ display: grid;
168
+ grid-template-columns: 1fr;
169
+ grid-gap: 10px;
170
+ align-items: center;
171
+ justify-items: flex-start;
172
+ cursor: pointer;
173
+ margin-left: 65px;
174
+ padding: 8px;
175
+ border-radius: 6px;
176
+ color: ${(props) => props.theme.colors.white};
177
+ font-weight: 700;
178
+ ${({ isActive }) =>
179
+ isActive &&
180
+ `
181
+ background: rgba(255, 255, 255, 0.1);
182
+ `}
183
+
184
+ &:hover {
185
+ background: rgba(255, 255, 255, 0.1);
186
+ }
187
+ `
188
+
189
+ const CollapseContainer = styled.div`
190
+ display: grid;
191
+ grid-template-columns: auto 1fr auto;
192
+ grid-gap: 20px;
193
+ padding: 4px;
194
+ border-radius: 6px;
195
+ align-items: center;
196
+ cursor: pointer;
197
+ &:hover {
198
+ background: rgba(255, 255, 255, 0.1);
199
+ }
200
+ `
201
+
202
+ const CollapseWrapper = styled.div`
203
+ display: grid;
204
+ grid-template-columns: 1fr;
205
+ grid-gap: 10px;
206
+ user-select: none;
207
+ margin-bottom: 2px;
208
+ `
209
+
210
+ const ArrowContainer = styled.div`
211
+ padding-bottom: 5px;
212
+ `
213
+
214
+ export default {
215
+ name: 'SideMenu',
216
+ components: {
217
+ PageContainer,
218
+ ListContainer,
219
+ ListItem,
220
+ ListText,
221
+ Icon,
222
+ IconContainer,
223
+ Spinner,
224
+ SpinnerContainer,
225
+ BottomSection,
226
+ RotateIcon,
227
+ AppVersion,
228
+ CollapseWrapper,
229
+ CollapseContainer,
230
+ SubRouter,
231
+ ArrowContainer
232
+ },
233
+ data() {
234
+ return {
235
+ activeDropdown: null
236
+ }
237
+ },
238
+ mounted() {
239
+ this.activeDropdown = this.activeParentTab
240
+ },
241
+ props: {
242
+ tabsData: {
243
+ required: true
244
+ },
245
+ activeTab: {
246
+ required: true
247
+ },
248
+ activeParentTab: {
249
+ required: false
250
+ },
251
+ hasLogout: {
252
+ required: false,
253
+ default: true
254
+ },
255
+ appVersion: {
256
+ required: false,
257
+ type: String
258
+ }
259
+ },
260
+ methods: {
261
+ toggleActiveDropdown(value) {
262
+ if (this.activeDropdown === value) {
263
+ this.activeDropdown = null
264
+ } else {
265
+ this.activeDropdown = value
266
+ }
267
+ }
268
+ }
269
+ }
270
+ </script>
@@ -10,7 +10,7 @@
10
10
  ref="tableRef"
11
11
  :isPositionAbsolute="doesTableContainDraggables"
12
12
  >
13
- <table-wrapper :fullWidth="fullWidth">
13
+ <table-wrapper class="main-table-wrapper" :fullWidth="fullWidth">
14
14
  <spinner-wrapper v-if="isLoading">
15
15
  <spinner />
16
16
  </spinner-wrapper>
@@ -72,7 +72,7 @@ const TableWrapper = styled('div', wrapperAttrs)`
72
72
  overflow-y: hidden;
73
73
 
74
74
  ::-webkit-scrollbar {
75
- height: 5px; //height of the whole scrollbar area
75
+ height: 10px; //height of the whole scrollbar area
76
76
  }
77
77
 
78
78
  ::-webkit-scrollbar-track {
@@ -81,7 +81,7 @@ const TableWrapper = styled('div', wrapperAttrs)`
81
81
  }
82
82
 
83
83
  ::-webkit-scrollbar-thumb {
84
- border-bottom: 5px solid ${(props) => props.theme.colors.purple}; // width of the actual scrollbar
84
+ border-bottom: 10px solid ${(props) => props.theme.colors.brightBlue}; // width of the actual scrollbar
85
85
  border-radius: 4px;
86
86
  }
87
87
  `
@@ -23,40 +23,42 @@
23
23
  v-for="child in childOpen"
24
24
  :key="child.value"
25
25
  @click.stop="
26
- onSelect({
27
- item: child,
28
- hasChildren: hasChildren(child)
29
- })
30
- "
26
+ onSelect({
27
+ item: child,
28
+ hasChildren: hasChildren(child)
29
+ })
30
+ "
31
31
  @keyup.enter.stop="
32
- onSelect({
33
- item: child,
34
- hasChildren: hasChildren(child)
35
- })
36
- "
32
+ onSelect({
33
+ item: child,
34
+ hasChildren: hasChildren(child)
35
+ })
36
+ "
37
37
  >
38
38
  {{ child.name }}
39
39
  </option-child>
40
40
  </children-container>
41
- <options-container v-if="!isLoading">
41
+ <options-container v-if="!isLoading" :textWrap="textWrap">
42
42
  <option-item
43
43
  v-for="(item, index) in options"
44
44
  :key="item.value"
45
+ :data-id="item.dataId"
45
46
  tabindex="0"
46
47
  @click.stop="onSelect({ item: item, hasChildren: hasChildren(item) })"
47
48
  @keyup.enter="
48
- onSelect({ item: item, hasChildren: hasChildren(item) })
49
- "
49
+ onSelect({ item: item, hasChildren: hasChildren(item) })
50
+ "
50
51
  @mouseover="onItemHover({ index, item })"
51
52
  :isDisabled="item.disabled"
53
+ :title="item.title"
52
54
  >
53
55
  <arrow-left
54
56
  :hasChildren="hasChildren(item)"
55
57
  v-if="hasChildren(item)"
56
58
  />
57
59
  <span>
58
- {{ item.name }}
59
- </span>
60
+ {{ item.name }}
61
+ </span>
60
62
  </option-item>
61
63
  </options-container>
62
64
  </template>
@@ -68,9 +70,10 @@
68
70
  // import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/threeDots"
69
71
  // To use:
70
72
  // <three-dots
73
+ // :isLoading="true"
71
74
  // :options="listOptions"
75
+ // @on-click="onClick($event)"
72
76
  // @on-select="onSelect($event)"
73
- // :isLoading="true"
74
77
  // />
75
78
  // options to pass:
76
79
  // listOptions: [
@@ -182,19 +185,18 @@ const LoadingContainer = styled.div`
182
185
  background: #fff;
183
186
  `
184
187
 
185
- const OptionsContainer = styled.div`
188
+ const OptionsContainerAttrs = { textWrap: Boolean }
189
+ const OptionsContainer = styled('div', OptionsContainerAttrs)`
186
190
  border: 1px solid ${(props) => props.theme.colors.grey3};
187
191
  display: grid;
188
192
  grid-template-columns: 1fr;
189
- min-width: 220px;
190
- max-width: 220px;
191
- width: max-content;
193
+ ${(props) => props.textWrap ? 'width: 220px' : 'width: max-content' };
192
194
  border-radius: 4px;
193
195
  background-color: #fff;
194
196
  max-height: 220px;
195
197
  overflow: auto;
196
198
  height: max-content;
197
- white-space: normal;
199
+ ${(props) => props.textWrap ? 'white-space: normal' : 'white-space: nowrap'};
198
200
  `
199
201
 
200
202
  const optionAttrs = { isDisabled: Boolean }
@@ -203,6 +205,8 @@ const OptionItem = styled('div', optionAttrs)`
203
205
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
204
206
  font-size: 13px;
205
207
  position: relative;
208
+ ${(props) => (props.isDisabled ? `background-color: ${ props.theme.colors.grey5 }!important` : '')};
209
+ ${(props) => (props.isDisabled ? `color: ${ props.theme.colors.grey2 }` : '')};
206
210
 
207
211
  &:hover {
208
212
  background-color: #ebeef4;
@@ -284,6 +288,10 @@ export default {
284
288
  isLoading: {
285
289
  required: false,
286
290
  default: false
291
+ },
292
+ textWrap: {
293
+ required: false,
294
+ default: true
287
295
  }
288
296
  },
289
297
  data() {
@@ -331,7 +339,7 @@ export default {
331
339
  },
332
340
  findRelativeParent(element) {
333
341
  while (element.parentElement) {
334
- if (window.getComputedStyle(element.parentElement).position === 'relative') {
342
+ if (window.getComputedStyle(element.parentElement).position === 'relative' || window.getComputedStyle(element.parentElement).position === 'absolute') {
335
343
  return element.parentElement
336
344
  }
337
345
  element = element.parentElement
@@ -368,6 +376,7 @@ export default {
368
376
  },
369
377
  onSelect({ item, hasChildren }) {
370
378
  if (hasChildren || item.disabled) {
379
+ this.$emit('on-click', item)
371
380
  return
372
381
  }
373
382
  this.$emit('on-select', item)
@@ -18,6 +18,7 @@ export const stringToNumber = ({
18
18
  selectedLang === 'de-lu' ||
19
19
  selectedLang === 'de-be' ||
20
20
  selectedLang === 'es-es' ||
21
+ selectedLang === 'ca-es' ||
21
22
  selectedLang === 'de' ||
22
23
  selectedLang === 'de-at' ||
23
24
  selectedLang === 'it' ||
@@ -38,7 +39,7 @@ export const stringToNumber = ({
38
39
  .replace(/[.\s]/g, '')
39
40
  .replace(/[,\s]/, '.')
40
41
  }
41
- } else if (selectedLang === 'en-us') {
42
+ } else if (selectedLang === 'en-us' || selectedLang === 'en-gb') {
42
43
  // replace commas with blank: 1,234.56 --> 1234.56
43
44
  if (allowNegative) {
44
45
  newVal = newVal.replace(/[^\d-.,']/g, '').replace(/[,\s]/g, '')
@@ -96,6 +97,7 @@ export const numberToString = ({ value, numberPrecision, minDecimals }) => {
96
97
  value = parseFloat(value)
97
98
  return value.toLocaleString(langForLocaleString(), {
98
99
  minimumFractionDigits: minimumRounding, // removing this for now. Why do we need this to be a minimum amount?
99
- maximumFractionDigits: numberPrecision
100
+ maximumFractionDigits:
101
+ numberPrecision < minimumRounding ? minimumRounding : numberPrecision
100
102
  })
101
103
  }
@@ -48,6 +48,8 @@ export const translateLang = (lang) => {
48
48
  return 'portuguese'
49
49
  } else if (lang === 'es-es') {
50
50
  return 'spanish'
51
+ } else if (lang === 'ca-es') {
52
+ return 'catalan_es'
51
53
  } else {
52
54
  return lang
53
55
  }
@@ -72,6 +74,8 @@ export const datePickerLang = (lang) => {
72
74
  return 'it'
73
75
  } else if (lang === 'en-us' || lang === 'en-gb') {
74
76
  return 'en'
77
+ } else if (lang === 'es-es' || lang === 'ca-es' || lang === 'pt-pt') {
78
+ return 'es'
75
79
  } else {
76
80
  return lang
77
81
  }
@@ -97,6 +101,8 @@ export const tinyLanguage = (lang) => {
97
101
  return 'fr_FR'
98
102
  } else if (lang === 'it' || lang === 'it-it' || lang === 'it-ch') {
99
103
  return 'it'
104
+ } else if (lang === 'es-es' || lang === 'ca-es') {
105
+ return 'es'
100
106
  } else if (lang === 'en-us') {
101
107
  return null
102
108
  } else {
@@ -114,7 +120,9 @@ export const langForLocaleString = () => {
114
120
  ? 'fr-fr'
115
121
  : localStorage.getItem('lang') === 'fr-ch'
116
122
  ? 'de-ch'
117
- : localStorage.getItem('lang')
123
+ : localStorage.getItem('lang') === 'ca-es'
124
+ ? 'es-es'
125
+ : localStorage.getItem('lang')
118
126
  : 'en-US'
119
127
  return selectedLang !== 'null' ? selectedLang : 'en-US'
120
128
  }