@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
@@ -3,10 +3,9 @@
3
3
  :position="position"
4
4
  :isOpen="isOpen"
5
5
  :class="{ visible: isOpen, hidden: !isOpen }"
6
- @click.native="onOutsideClose()"
7
6
  :backdrop="backdrop"
8
7
  >
9
- <modal-container @click.stop>
8
+ <modal-container @click="onClickModalContainer">
10
9
  <spinner v-if="isLoading" size="50px" :limitedToModal="true" />
11
10
  <content-container :visible="!isLoading">
12
11
  <slot />
@@ -21,10 +20,13 @@
21
20
  </template>
22
21
 
23
22
  <script>
23
+ // Rules: (as defined in https://e-turnity.atlassian.net/browse/EPDM-9694)
24
+ // 1. On clicking the “escape” key, close the modal onCloseModal()
25
+ // 2. Always prevent outside close
24
26
  // import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
25
27
  // This is a more flexible modal box, where the parent can decide how the body of the modal looks
26
28
  // To use:
27
- // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
29
+ // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true" :stopPropagation="false">
28
30
  // <div>Data....</div>
29
31
  // </modal>
30
32
 
@@ -83,6 +85,22 @@ const ModalContainer = styled.div`
83
85
  min-width: 100px;
84
86
  min-height: 100px;
85
87
 
88
+ ::-webkit-scrollbar {
89
+ width: 0.3em;
90
+ height: 100%;
91
+ background-color: ${(props) => props.theme.colors.grey5};
92
+ }
93
+
94
+ /* Make scrollbar visible when needed */
95
+ ::-webkit-scrollbar-thumb {
96
+ background-color: ${(props) => props.theme.colors.grey3};
97
+ }
98
+
99
+ /* Make scrollbar track visible when needed */
100
+ ::-webkit-scrollbar-track {
101
+ background-color: ${(props) => props.theme.colors.grey5};
102
+ }
103
+
86
104
  .close {
87
105
  position: absolute;
88
106
  right: 20px;
@@ -118,10 +136,6 @@ export default {
118
136
  required: true,
119
137
  default: false
120
138
  },
121
- preventOutsideClose: {
122
- required: false,
123
- default: false
124
- },
125
139
  isLoading: {
126
140
  required: false,
127
141
  default: false
@@ -137,22 +151,41 @@ export default {
137
151
  position: {
138
152
  required: false,
139
153
  default: 'fixed'
154
+ },
155
+ stopPropagation: {
156
+ type: Boolean,
157
+ default: true
140
158
  }
141
159
  },
160
+ beforeDestroy() {
161
+ window.removeEventListener('keydown', this.handleKeyDown)
162
+ },
142
163
  methods: {
143
164
  onCloseModal() {
144
165
  this.$emit('on-close')
145
166
  },
146
- onOutsideClose() {
147
- // If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
148
- if (!this.preventOutsideClose) {
149
- this.$emit('on-close')
167
+ handleKeyDown({ key }) {
168
+ if (key === 'Escape') {
169
+ this.onCloseModal()
170
+ }
171
+ },
172
+ onClickModalContainer(event) {
173
+ if (this.stopPropagation) {
174
+ event.stopPropagation()
150
175
  }
151
176
  }
152
177
  },
153
178
  watch: {
154
- isOpen: function (newVal) {
155
- document.body.style.overflow = newVal ? 'hidden' : ''
179
+ isOpen: {
180
+ immediate: true,
181
+ handler(isOpen) {
182
+ document.body.style.overflow = isOpen ? 'hidden' : ''
183
+ if (isOpen) {
184
+ window.addEventListener('keydown', this.handleKeyDown)
185
+ } else {
186
+ window.removeEventListener('keydown', this.handleKeyDown)
187
+ }
188
+ }
156
189
  }
157
190
  }
158
191
  }
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <roofTabWrap>
3
+ <tab
4
+ v-for="(tab, index) in tabsData"
5
+ :key="tab.id"
6
+ :isDisabled="!!tab['isDisabled']"
7
+ :textColor="tab['textColor']"
8
+ :active="isIndexKey ? index === activeTab : tab[tabKey] === activeTab"
9
+ @click="$emit('tab-click', isIndexKey ? index : tab[tabKey])"
10
+ >
11
+ <Option :isDisabled="!!tab['isDisabled']" :textColor="tab['textColor']">
12
+ <Uppercase>{{ tab[tabLabel] }}</Uppercase>
13
+ <info-text
14
+ v-if="tab['labelInfoText']"
15
+ :text="tab['labelInfoText']"
16
+ :alignArrow="tab['labelInfoAlign']"
17
+ />
18
+ </Option>
19
+ </tab>
20
+ <bottomLine />
21
+ </roofTabWrap>
22
+ </template>
23
+
24
+ <script>
25
+ import styled from 'vue-styled-components'
26
+ import InfoText from '../infoText'
27
+ const TabAttr = {
28
+ active: Boolean,
29
+ isDisabled: Boolean,
30
+ textColor: String
31
+ }
32
+
33
+ const bottomLine = styled('div')`
34
+ position: absolute;
35
+ bottom: 0;
36
+ left: 0;
37
+ height: 1px;
38
+ width: 100%;
39
+ background-color: #b2b9c5;
40
+ `
41
+ const roofTabWrap = styled('div')`
42
+ display: flex;
43
+ align-items: center;
44
+ position: relative;
45
+ font-size: 13px;
46
+ font-weight: 700;
47
+ `
48
+ const Uppercase = styled('span')`
49
+ text-transform: uppercase;
50
+ `
51
+ const Option = styled('div',TabAttr)`
52
+ font-size: 13px;
53
+ font-weight: 700;
54
+ display:flex;
55
+ justify-content: center;
56
+ flex-direction: row;
57
+ gap: 10px;
58
+ color: ${props=>props.textColor ?
59
+ props.theme.colors[props.textColor] ? props.theme.colors[props.textColor] : props.textColor :
60
+ props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
61
+ `
62
+ const Tab = styled('div', TabAttr)`
63
+ padding: 16px 10px;
64
+ margin-right: 5px;
65
+ position: relative;
66
+ top: ${(props) => (props.isDisabled ? '-1px' : '0')};
67
+ z-index: 10;
68
+ border-bottom: 2px solid
69
+ ${(props) => (props.active ? props.theme.colors.primary : 'transparent')};
70
+ background-color: ${(props) => (props.isDisabled ? props.theme.colors.grey5 : 'transparent')};
71
+ transition: 0.2s ease;
72
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
73
+ min-width: 140px;
74
+ display: flex !important;
75
+ align-items: center;
76
+ justify-content: space-between;
77
+ min-height: 55px;
78
+ &:hover {
79
+ border-color: ${(props) => props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.primary};
80
+ }
81
+ `
82
+
83
+ export default {
84
+ name: 'Tabs',
85
+
86
+ components: {
87
+ Tab,
88
+ bottomLine,
89
+ roofTabWrap,
90
+ Option,
91
+ InfoText,
92
+ Uppercase
93
+ },
94
+
95
+ props: {
96
+ tabsData: { required: true },
97
+ activeTab: { required: true },
98
+ isIndexKey: { type: Boolean, default: false },
99
+ tabKey: { type: String, default: '' },
100
+ tabLabel: { type: String, default: '' }
101
+ }
102
+ }
103
+ </script>
104
+
105
+ <style lang="scss" scoped></style>
@@ -4,11 +4,8 @@
4
4
  {{ text }}
5
5
  </span>
6
6
  <info-text
7
- :text="infoText"
8
7
  v-if="!!infoText"
9
- size="14px"
10
- borderColor="#ccc"
11
- :alignText="alignInfoText"
8
+ :text="infoText"
12
9
  />
13
10
  </subtitle-text>
14
11
  </template>
@@ -55,10 +52,6 @@ export default {
55
52
  required: false,
56
53
  default: null,
57
54
  },
58
- alignInfoText: {
59
- required: false,
60
- default: "left",
61
- },
62
55
  marginBottom: {
63
56
  required: false,
64
57
  default: "30px",
@@ -1,5 +1,14 @@
1
1
  <template>
2
- <title-text :color="color" :fontSize="fontSize" :uppercase="uppercase">{{ text }}</title-text>
2
+ <title-wrap :hasInfoText="!!infoText">
3
+ <title-text :color="color" :fontSize="fontSize" :uppercase="uppercase">
4
+ {{ text }}
5
+ </title-text>
6
+ <info-text
7
+ v-if="!!infoText"
8
+ :text="infoText"
9
+ :alignArrow="infoAlign"
10
+ />
11
+ </title-wrap>
3
12
  </template>
4
13
 
5
14
  <script>
@@ -10,20 +19,32 @@
10
19
  // color="red"
11
20
  // />
12
21
  import styled from "vue-styled-components"
22
+ import InfoText from "../infoText"
13
23
 
14
- const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
15
- const TitleText = styled("div", textAttrs)`
24
+ const wrapAttrs = { hasInfoText: Boolean }
25
+ const TitleWrap = styled("div", wrapAttrs)`
26
+ display: grid;
27
+ align-items: center;
28
+ grid-gap: 12px;
29
+ grid-template-columns: ${(props) =>
30
+ props.hasInfoText ? "auto auto 1fr" : "1fr"};
31
+ margin-bottom: 20px;
32
+ `
33
+
34
+ const titleAttrs = { color: String, fontSize: String, uppercase: Boolean }
35
+ const TitleText = styled('span', titleAttrs)`
16
36
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
37
  font-weight: bold;
18
38
  font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
19
39
  text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
20
- margin-bottom: 20px;
21
40
  `
22
41
 
23
42
  export default {
24
43
  name: "page-title",
25
44
  components: {
26
45
  TitleText,
46
+ TitleWrap,
47
+ InfoText
27
48
  },
28
49
  props: {
29
50
  text: {
@@ -39,6 +60,13 @@ export default {
39
60
  uppercase: {
40
61
  required: false,
41
62
  default: true
63
+ },
64
+ infoText: {
65
+ required: false,
66
+ default: null,
67
+ },
68
+ infoAlign: {
69
+ required: false,
42
70
  }
43
71
  },
44
72
  }
@@ -1,137 +1,144 @@
1
1
  <template>
2
- <!-- Check, if pages more than 1 -->
3
- <paginationWrapper v-if="paginationParams.pages > 1">
4
- <!-- Back button -->
5
- <paginationLink
6
- v-if="paginationParams.previous"
7
- @click="fetchPage(paginationParams.previous)"
8
- >
9
- <arrowIconContainer>
10
- <icon name="arrow_left" color="#1a237e" size="12px"/>
11
- </arrowIconContainer>
12
- <arrowText>{{ $gettext('back') }}</arrowText>
13
- </paginationLink>
14
-
15
- <!-- First page -->
16
- <paginationLink
17
- v-if="currentPage > 2 && paginationParams.pages > 3"
18
- @click="fetchPage(1)"
19
- >1</paginationLink
20
- >
21
-
22
- <!-- Back tree dots -->
23
- <span v-if="currentPage > 3 && paginationParams.pages > 4">...</span>
24
-
25
- <!-- Current block -->
26
- <paginationLink
27
- v-for="number in paginationNumbers()"
28
- :key="number"
29
- :class="[currentPage === number ? 'active' : '']"
30
- @click="fetchPage(number)"
31
- >{{ number }}</paginationLink
32
- >
33
-
34
- <!-- Forward tree dots -->
35
- <span
36
- v-if="
37
- paginationParams.pages - currentPage > 2 && paginationParams.pages > 4
38
- "
39
- >...</span
40
- >
41
-
42
- <!-- End page -->
43
- <paginationLink
44
- v-if="
45
- paginationParams.pages - currentPage > 1 && paginationParams.pages > 3
46
- "
47
- @click="fetchPage(paginationParams.pages)"
48
- >{{ paginationParams.pages }}</paginationLink
49
- >
50
-
51
- <!-- Forward button -->
52
- <paginationLink
53
- v-if="paginationParams.next"
54
- @click="fetchPage(paginationParams.next)"
55
- >
56
- <arrowText>{{ $gettext('forward') }}</arrowText>
57
- <arrowIconContainer>
58
- <icon name="arrow_right" color="#1a237e" size="12px" />
59
- </arrowIconContainer>
60
- </paginationLink>
61
- </paginationWrapper>
62
- </template>
63
-
64
- <script>
65
- import styled from "vue-styled-components"
66
- import icon from "../icon"
67
- const paginationWrapper=styled.nav`
68
- color: #1a237e;
69
- font-size: 13px;
70
- display: -webkit-box;
71
- display: -ms-flexbox;
72
- display: flex;
73
- -ms-flex-wrap: wrap;
74
- flex-wrap: wrap;
75
- -webkit-box-pack: end;
76
- -ms-flex-pack: end;
77
- justify-content: flex-end;
78
- -webkit-box-align: center;
79
- -ms-flex-align: center;
80
- align-items: center;
81
- margin-bottom: 2px;
82
- margin-top: 10px;
2
+ <!-- Check, if pages more than 1 -->
3
+ <paginationWrapper v-if="paginationParams.pages > 1">
4
+ <!-- Back button -->
5
+ <paginationLink
6
+ v-if="paginationParams.previous"
7
+ @click="fetchPage(paginationParams.previous)"
8
+ >
9
+ <arrowIconContainer>
10
+ <icon
11
+ name="arrow_left"
12
+ :color="getTheme.colors.brightBlue"
13
+ size="12px"
14
+ />
15
+ </arrowIconContainer>
16
+ <arrowText>{{ $gettext('back') }}</arrowText>
17
+ </paginationLink>
18
+
19
+ <!-- First page -->
20
+ <paginationLink
21
+ v-if="currentPage > 2 && paginationParams.pages > 3"
22
+ @click="fetchPage(1)"
23
+ >1</paginationLink
24
+ >
25
+
26
+ <!-- Back tree dots -->
27
+ <span v-if="currentPage > 3 && paginationParams.pages > 4">...</span>
28
+
29
+ <!-- Current block -->
30
+ <paginationLink
31
+ v-for="number in paginationNumbers()"
32
+ :key="number"
33
+ :class="[currentPage === number ? 'active' : '']"
34
+ @click="fetchPage(number)"
35
+ >{{ number }}</paginationLink
36
+ >
37
+
38
+ <!-- Forward tree dots -->
39
+ <span
40
+ v-if="
41
+ paginationParams.pages - currentPage > 2 && paginationParams.pages > 4
42
+ "
43
+ >...</span
44
+ >
45
+
46
+ <!-- End page -->
47
+ <paginationLink
48
+ v-if="
49
+ paginationParams.pages - currentPage > 1 && paginationParams.pages > 3
50
+ "
51
+ @click="fetchPage(paginationParams.pages)"
52
+ >{{ paginationParams.pages }}</paginationLink
53
+ >
54
+
55
+ <!-- Forward button -->
56
+ <paginationLink
57
+ v-if="paginationParams.next"
58
+ @click="fetchPage(paginationParams.next)"
59
+ >
60
+ <arrowText>{{ $gettext('forward') }}</arrowText>
61
+ <arrowIconContainer>
62
+ <icon
63
+ name="arrow_right"
64
+ :color="getTheme.colors.brightBlue"
65
+ size="12px"
66
+ />
67
+ </arrowIconContainer>
68
+ </paginationLink>
69
+ </paginationWrapper>
70
+ </template>
71
+
72
+ <script>
73
+ import styled from 'vue-styled-components'
74
+ import icon from '../icon'
75
+ import theme from '@/assets/theme.js'
76
+
77
+ const paginationWrapper = styled.nav`
78
+ color: ${(props) => props.theme.brightBlue};
79
+ font-size: 13px;
80
+ display: flex;
81
+ flex-wrap: wrap;
82
+ justify-content: flex-end;
83
+ align-items: center;
84
+ margin-bottom: 2px;
85
+ margin-top: 10px;
83
86
  `
84
- const paginationLink=styled.div`
85
- display: flex;
86
- padding: 0px 5px;
87
- margin: 0 2px;
88
- text-align: center;
89
- border-radius: 3px;
90
- white-space: nowrap;
91
- cursor: pointer;
87
+ const paginationLink = styled.div`
88
+ display: flex;
89
+ padding: 0px 5px;
90
+ margin: 0 2px;
91
+ text-align: center;
92
+ border-radius: 3px;
93
+ white-space: nowrap;
94
+ cursor: pointer;
92
95
 
93
- &.active{
94
- color: #fff;
95
- background-color: #5c67ac;
96
- padding: 7px 12px;
97
- border-radius: 4px;
96
+ &.active {
97
+ color: #fff;
98
+ background-color: ${(props) => props.theme.brightBlue};
99
+ padding: 7px 12px;
100
+ border-radius: 4px;
101
+ }
102
+ `
103
+ const arrowText = styled.div``
104
+ const arrowIconContainer = styled.div`
105
+ margin: 0 10px;
106
+ display: flex;
107
+ align-items: center;
108
+ `
109
+ export default {
110
+ name: 'pagination-component',
111
+ components: {
112
+ paginationWrapper,
113
+ paginationLink,
114
+ icon,
115
+ arrowText,
116
+ arrowIconContainer
117
+ },
118
+ props: ['fetchPage', 'currentPage', 'paginationParams'],
119
+ computed: {
120
+ getTheme() {
121
+ return theme
98
122
  }
99
- `
100
- const arrowText=styled.div``
101
- const arrowIconContainer=styled.div`
102
- margin:0 10px;
103
- display:flex;
104
- align-items: center;
105
- `
106
- export default {
107
- name: 'pagination-component',
108
- components:{
109
- paginationWrapper,
110
- paginationLink,
111
- icon,
112
- arrowText,
113
- arrowIconContainer
123
+ },
124
+ methods: {
125
+ getNewProjects(num) {
126
+ this.$emit('on-pagination-change', num)
114
127
  },
115
- props: ["fetchPage","currentPage","paginationParams"],
116
- methods: {
117
- getNewProjects(num) {
118
- this.$emit('on-pagination-change', num)
119
- },
120
- paginationNumbers() {
121
- const prev = this.paginationParams.previous
122
- const next = this.paginationParams.next
123
- const n = prev + 1 || next - 1
124
- if (this.paginationParams.pages === 2) {
125
- return prev ? [n - 1, n] : [n, n + 1]
126
- } else {
127
- return prev
128
- ? next
129
- ? [n - 1, n, n + 1]
130
- : [n - 2, n - 1, n]
131
- : [n, n + 1, n + 2]
132
- }
128
+ paginationNumbers() {
129
+ const prev = this.paginationParams.previous
130
+ const next = this.paginationParams.next
131
+ const n = prev + 1 || next - 1
132
+ if (this.paginationParams.pages === 2) {
133
+ return prev ? [n - 1, n] : [n, n + 1]
134
+ } else {
135
+ return prev
136
+ ? next
137
+ ? [n - 1, n, n + 1]
138
+ : [n - 2, n - 1, n]
139
+ : [n, n + 1, n + 2]
133
140
  }
134
141
  }
135
142
  }
136
- </script>
137
-
143
+ }
144
+ </script>