@eturnity/eturnity_reusable_components 6.43.9-EPDM-3186.2 → 6.43.9-EPDM-6751.0

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.43.9-EPDM-3186.2",
3
+ "version": "6.43.9-EPDM-6751.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -63,4 +63,4 @@
63
63
  "author": "Aaron Enser",
64
64
  "license": "ISC",
65
65
  "homepage": "https://bitbucket.org/eturnitydevs/eturnity_reusable_components#readme"
66
- }
66
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17 10H1C0.45 10 0 10.45 0 11V17C0 17.55 0.45 18 1 18H17C17.55 18 18 17.55 18 17V11C18 10.45 17.55 10 17 10ZM4 16C2.9 16 2 15.1 2 14C2 12.9 2.9 12 4 12C5.1 12 6 12.9 6 14C6 15.1 5.1 16 4 16ZM17 0H1C0.45 0 0 0.45 0 1V7C0 7.55 0.45 8 1 8H17C17.55 8 18 7.55 18 7V1C18 0.45 17.55 0 17 0ZM4 6C2.9 6 2 5.1 2 4C2 2.9 2.9 2 4 2C5.1 2 6 2.9 6 4C6 5.1 5.1 6 4 6Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 10H8V0H0V10ZM0 18H8V12H0V18ZM10 18H18V8H10V18ZM10 0V6H18V0H10Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 12H8V10H0V12ZM0 16H8V14H0V16ZM0 8H8V6H0V8ZM0 2V4H8V2H0ZM10 2H18V16H10V2Z" fill="white"/>
3
+ </svg>
@@ -613,7 +613,7 @@ export default {
613
613
  return type === 'multi_select_integer' || type === 'multi_select_string'
614
614
  },
615
615
  isRangeSelector(type) {
616
- return type === 'integer_range'
616
+ return type === 'integer_range' || type === 'number_range'
617
617
  },
618
618
  isDateSelector(type) {
619
619
  return type === 'datetime'
@@ -120,10 +120,11 @@ export default {
120
120
  isStriked:{
121
121
  required:false,
122
122
  default:false
123
+
124
+ }
125
+ },
126
+ data() {
127
+ return {}
123
128
  }
124
- },
125
- data() {
126
- return {}
127
129
  }
128
- }
129
130
  </script>
@@ -2,6 +2,7 @@
2
2
  <page-container :withDate="!!date">
3
3
  <marker-container
4
4
  v-if="markerData"
5
+ :hasBorderRadius="hasBorderRadius"
5
6
  :backgroundColor="markerData.color"
6
7
  :hasIcon="!!iconName"
7
8
  :isEditionAllowed="editionAllowed"
@@ -119,6 +120,7 @@ const CtaContainer = styled.div`
119
120
  `
120
121
 
121
122
  const MarkerAttrs = {
123
+ hasBorderRadius: Boolean,
122
124
  backgroundColor: String,
123
125
  hasIcon: Boolean,
124
126
  isEditionAllowed: Boolean,
@@ -136,7 +138,7 @@ const MarkerContainer = styled('div', MarkerAttrs)`
136
138
  color: ${(props) => props.theme.colors.white};
137
139
  background-color: ${(props) =>
138
140
  props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
139
- border-radius: 4px;
141
+ border-radius: ${(props) => (props.hasBorderRadius ? '4px' : '0')};
140
142
  white-space: nowrap;
141
143
  cursor: ${(props) => props.isEditionAllowed ? 'pointer' : props.cursor};
142
144
 
@@ -242,6 +244,10 @@ export default {
242
244
  cursor: {
243
245
  required: false,
244
246
  default: 'default'
247
+ },
248
+ hasBorderRadius: {
249
+ required: false,
250
+ default: true
245
251
  }
246
252
  },
247
253
  data() {
@@ -0,0 +1,262 @@
1
+ <template>
2
+ <page-container>
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
+ :isActive="activeTab === item.key"
12
+ @click="$emit('tab-click', { activeKey: item.key })"
13
+ >
14
+ <icon-container :isActive="activeTab === item.key">
15
+ <icon :name="item.icon" color="#fff" cursor="pointer" size="18px" />
16
+ </icon-container>
17
+ <list-text>{{ $gettext(item.label) }}</list-text>
18
+ </list-item>
19
+ <collapse-wrapper v-else :key="idx + item.key">
20
+ <collapse-container @click="toggleActiveDropdown(item.key)">
21
+ <icon-container :isActive="activeParentTab === item.key">
22
+ <icon
23
+ :name="item.icon"
24
+ color="#fff"
25
+ cursor="pointer"
26
+ size="18px"
27
+ />
28
+ </icon-container>
29
+ <list-text>{{ $gettext(item.label) }}</list-text>
30
+ <arrow-container>
31
+ <icon
32
+ :name="activeDropdown === item.key ? 'arrow_up' : 'arrow_down'"
33
+ color="white"
34
+ size="10px"
35
+ />
36
+ </arrow-container>
37
+ </collapse-container>
38
+ <template v-if="activeDropdown === item.key">
39
+ <sub-router
40
+ v-for="subItem in item.children"
41
+ :key="subItem.key"
42
+ :isActive="activeTab === subItem.key"
43
+ @click="
44
+ $emit('tab-click', {
45
+ activeKey: subItem.key,
46
+ parentKey: item.key
47
+ })
48
+ "
49
+ >
50
+ {{ $gettext(subItem.label) }}
51
+ </sub-router>
52
+ </template>
53
+ </collapse-wrapper>
54
+ </template>
55
+ </list-container>
56
+ <bottom-section v-if="hasLogout">
57
+ <icon-container
58
+ :isActive="false"
59
+ :isButton="true"
60
+ @click="$emit('on-logout')"
61
+ >
62
+ <rotate-icon
63
+ name="initial_situation"
64
+ color="#fff"
65
+ cursor="pointer"
66
+ size="18px"
67
+ />
68
+ </icon-container>
69
+ <app-version>{{ appVersion }}</app-version>
70
+ </bottom-section>
71
+ </page-container>
72
+ </template>
73
+
74
+ <script>
75
+ import styled from 'vue-styled-components'
76
+ import Icon from '../icon'
77
+ import Spinner from '../spinner'
78
+
79
+ const PageContainer = styled.div`
80
+ background-color: ${(props) => props.theme.colors.grey6};
81
+ padding: 14px 12px;
82
+ min-width: 220px;
83
+ display: flex;
84
+ flex-direction: column;
85
+ justify-content: space-between;
86
+ `
87
+
88
+ const ListContainer = styled.div`
89
+ display: grid;
90
+ grid-gap: 6px;
91
+ `
92
+
93
+ const IconAttrs = { isActive: Boolean, isButton: Boolean }
94
+
95
+ const ListItem = styled('div', IconAttrs)`
96
+ display: grid;
97
+ align-items: center;
98
+ grid-template-columns: auto 1fr;
99
+ grid-gap: 20px;
100
+ cursor: pointer;
101
+ padding: 4px;
102
+ border-radius: 6px;
103
+ background-color: ${(props) =>
104
+ props.isActive ? 'rgba(255, 255, 255, 0.1)' : ''};
105
+
106
+ :hover {
107
+ background-color: rgba(255, 255, 255, 0.1);
108
+ }
109
+ `
110
+
111
+ const ListText = styled.div`
112
+ font-size: 16px;
113
+ font-weight: 700;
114
+ color: ${(props) => props.theme.colors.white};
115
+ `
116
+
117
+ const IconContainer = styled('div', IconAttrs)`
118
+ display: grid;
119
+ align-items: center;
120
+ justify-items: center;
121
+ width: 32px;
122
+ height: 32px;
123
+ background-color: ${(props) =>
124
+ props.isActive ? props.theme.colors.red : 'rgba(255, 255, 255, 0.2)'};
125
+ border-radius: 6px;
126
+
127
+ ${({ isButton = false }) =>
128
+ isButton &&
129
+ `
130
+ cursor: pointer;
131
+ &:hover {
132
+ background-color: rgba(255, 255, 255, 0.3);
133
+ }
134
+ `}
135
+ `
136
+
137
+ const SpinnerContainer = styled.div`
138
+ margin-top: 30px;
139
+ `
140
+
141
+ const BottomSection = styled.div`
142
+ display: flex;
143
+ justify-content: space-between;
144
+ align-items: center;
145
+ `
146
+
147
+ const RotateIcon = styled(Icon)`
148
+ transform: rotate(-90deg);
149
+ `
150
+
151
+ const AppVersion = styled.p`
152
+ font-size: 11px;
153
+ line-height: 13px;
154
+ color: ${(props) => props.theme.colors.white};
155
+ margin-right: 6px;
156
+ `
157
+
158
+ const SubRouter = styled('div', IconAttrs)`
159
+ display: grid;
160
+ grid-template-columns: 1fr;
161
+ grid-gap: 10px;
162
+ align-items: center;
163
+ justify-items: flex-start;
164
+ cursor: pointer;
165
+ margin-left: 65px;
166
+ padding: 8px;
167
+ border-radius: 6px;
168
+ color: ${(props) => props.theme.colors.white};
169
+ font-weight: 700;
170
+ ${({ isActive }) =>
171
+ isActive &&
172
+ `
173
+ background: rgba(255, 255, 255, 0.1);
174
+ `}
175
+
176
+ &:hover {
177
+ background: rgba(255, 255, 255, 0.1);
178
+ }
179
+ `
180
+
181
+ const CollapseContainer = styled.div`
182
+ display: grid;
183
+ grid-template-columns: auto 1fr auto;
184
+ grid-gap: 20px;
185
+ padding: 4px;
186
+ border-radius: 6px;
187
+ align-items: center;
188
+ cursor: pointer;
189
+ &:hover {
190
+ background: rgba(255, 255, 255, 0.1);
191
+ }
192
+ `
193
+
194
+ const CollapseWrapper = styled.div`
195
+ display: grid;
196
+ grid-template-columns: 1fr;
197
+ grid-gap: 10px;
198
+ user-select: none;
199
+ margin-bottom: 2px;
200
+ `
201
+
202
+ const ArrowContainer = styled.div`
203
+ padding-bottom: 5px;
204
+ `
205
+
206
+ export default {
207
+ name: 'SideMenu',
208
+ components: {
209
+ PageContainer,
210
+ ListContainer,
211
+ ListItem,
212
+ ListText,
213
+ Icon,
214
+ IconContainer,
215
+ Spinner,
216
+ SpinnerContainer,
217
+ BottomSection,
218
+ RotateIcon,
219
+ AppVersion,
220
+ CollapseWrapper,
221
+ CollapseContainer,
222
+ SubRouter,
223
+ ArrowContainer
224
+ },
225
+ data() {
226
+ return {
227
+ activeDropdown: null
228
+ }
229
+ },
230
+ mounted() {
231
+ this.activeDropdown = this.activeParentTab
232
+ },
233
+ props: {
234
+ tabsData: {
235
+ required: true
236
+ },
237
+ activeTab: {
238
+ required: true
239
+ },
240
+ activeParentTab: {
241
+ required: false
242
+ },
243
+ hasLogout: {
244
+ required: false,
245
+ default: true
246
+ },
247
+ appVersion: {
248
+ required: false,
249
+ type: String
250
+ }
251
+ },
252
+ methods: {
253
+ toggleActiveDropdown(value) {
254
+ if (this.activeDropdown === value) {
255
+ this.activeDropdown = null
256
+ } else {
257
+ this.activeDropdown = value
258
+ }
259
+ }
260
+ }
261
+ }
262
+ </script>
@@ -1,11 +1,12 @@
1
- import { langForLocaleString } from './translateLang'
2
-
3
1
  export const stringToNumber = ({
4
- value = '',
2
+ value,
5
3
  numberPrecision = false,
6
- allowNegative = false
4
+ allowNegative
7
5
  }) => {
8
6
  // This is for saving. It converts our input string to a readable number
7
+ if (value === undefined) {
8
+ value = ''
9
+ }
9
10
  let newVal = value.toString()
10
11
  const selectedLang = localStorage.getItem('lang')
11
12
  // The first replace will replace not allowed characters with a blank
@@ -92,18 +93,17 @@ export const stringToNumber = ({
92
93
  }
93
94
 
94
95
  export const numberToString = ({ value, numberPrecision }) => {
95
- value = parseFloat(value)
96
- let minNumberPrecision
97
- let maxNumberPrecision
98
- if (typeof numberPrecision === 'number') {
99
- minNumberPrecision = numberPrecision
100
- maxNumberPrecision = numberPrecision
101
- } else {
102
- minNumberPrecision = numberPrecision[0]
103
- maxNumberPrecision = numberPrecision[1]
96
+ let selectedLang = localStorage.getItem('lang')
97
+ ? localStorage.getItem('lang') === 'fr-lu'
98
+ ? 'fr-fr'
99
+ : localStorage.getItem('lang')
100
+ : 'en-US'
101
+ if (selectedLang == 'null') {
102
+ selectedLang = 'en-US'
104
103
  }
105
- return value.toLocaleString(langForLocaleString(), {
106
- minimumFractionDigits: minNumberPrecision,
107
- maximumFractionDigits: maxNumberPrecision
104
+ value = parseFloat(value)
105
+ return value.toLocaleString(selectedLang, {
106
+ minimumFractionDigits: numberPrecision,
107
+ maximumFractionDigits: numberPrecision
108
108
  })
109
109
  }
@@ -78,7 +78,6 @@ export const datePickerLang = (lang) => {
78
78
  }
79
79
 
80
80
  export const tinyLanguage = (lang) => {
81
- // the function is used to pass correct language to Tiny MCE text editor https://www.tiny.cloud/docs/tinymce/6/ui-localization/#language
82
81
  if (
83
82
  lang === 'de' ||
84
83
  lang === 'de-de' ||
@@ -107,14 +106,3 @@ export const tinyLanguage = (lang) => {
107
106
  return langCode
108
107
  }
109
108
  }
110
-
111
- export const langForLocaleString = () => {
112
- const selectedLang = localStorage.getItem('lang')
113
- ? localStorage.getItem('lang') === 'fr-lu'
114
- ? 'fr-fr'
115
- : localStorage.getItem('lang') === 'fr-ch'
116
- ? 'de-ch'
117
- : localStorage.getItem('lang')
118
- : 'en-US'
119
- return selectedLang !== 'null' ? selectedLang : 'en-US'
120
- }