@eturnity/eturnity_reusable_components 6.37.0-EPDM-8148.6 → 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 +138 -68
  31. package/src/components/inputs/select/option/index.vue +15 -2
  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
@@ -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
  }