@eturnity/eturnity_reusable_components 6.48.2 → 6.50.1-EPDM-9012.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.
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <container>
3
- <flex-wrapper :size="size" :disabled="disabled" @click="onToggleChange">
3
+ <flex-wrapper
4
+ :size="size"
5
+ :disabled="disabled"
6
+ @click="onToggleChange"
7
+ :data-id="dataId"
8
+ >
4
9
  <label-container
5
10
  v-if="label && labelAlign === 'left'"
6
11
  :hasInfoMessage="!!infoTextMessage"
@@ -9,9 +14,6 @@
9
14
  <info-text
10
15
  v-if="infoTextMessage"
11
16
  :text="infoTextMessage"
12
- borderColor="#ccc"
13
- size="14px"
14
- :alignText="infoTextAlign"
15
17
  />
16
18
  </label-container>
17
19
  <toggle-wrapper
@@ -45,9 +47,6 @@
45
47
  @click.native.stop
46
48
  v-if="infoTextMessage"
47
49
  :text="infoTextMessage"
48
- borderColor="#ccc"
49
- size="14px"
50
- :alignText="infoTextAlign"
51
50
  />
52
51
  </label-container>
53
52
  </flex-wrapper>
@@ -67,29 +66,29 @@
67
66
  // labelAlign="right"
68
67
  // fontColor="black"
69
68
  // :disabled="true"
70
- // infoTextAlign="right" // left by default
71
69
  // infoTextMessage="My info message"
70
+ // dataId="test_data_id"
72
71
  // />
73
72
 
74
- import styled from "vue-styled-components"
75
- import InfoText from "../../infoText"
73
+ import styled from 'vue-styled-components'
74
+ import InfoText from '../../infoText'
76
75
 
77
76
  const Container = styled.div`
78
77
  display: inline-block;
79
78
  `
80
79
 
81
80
  const flexAttrs = { size: String, disabled: Boolean }
82
- const FlexWrapper = styled("div", flexAttrs)`
81
+ const FlexWrapper = styled('div', flexAttrs)`
83
82
  display: grid;
84
83
  grid-template-columns: auto 1fr;
85
84
  grid-gap: ${(props) =>
86
- props.size === "medium"
87
- ? "20px"
88
- : props.size === "small"
89
- ? "10px"
90
- : "20px"};
85
+ props.size === 'medium'
86
+ ? '20px'
87
+ : props.size === 'small'
88
+ ? '10px'
89
+ : '20px'};
91
90
  align-items: center;
92
- cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
91
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
93
92
  `
94
93
 
95
94
  const toggleAttrs = {
@@ -97,43 +96,43 @@ const toggleAttrs = {
97
96
  fontColor: String,
98
97
  disabled: Boolean,
99
98
  backgroundColor: String,
100
- isChecked: Boolean,
99
+ isChecked: Boolean
101
100
  }
102
- const LabelText = styled("div", toggleAttrs)`
101
+ const LabelText = styled('div', toggleAttrs)`
103
102
  color: ${(props) =>
104
103
  props.fontColor ? props.fontColor : props.theme.colors.darkGray};
105
104
  font-size: ${(props) =>
106
- props.size === "medium"
107
- ? "16px"
108
- : props.size === "small"
109
- ? "13px"
110
- : "16px"};
105
+ props.size === 'medium'
106
+ ? '16px'
107
+ : props.size === 'small'
108
+ ? '13px'
109
+ : '16px'};
111
110
  `
112
111
 
113
- const ToggleWrapper = styled("span", toggleAttrs)`
112
+ const ToggleWrapper = styled('span', toggleAttrs)`
114
113
  display: inline-block;
115
114
  border: ${(props) =>
116
115
  props.disabled
117
- ? "1px solid " + props.theme.colors.disabled
116
+ ? '1px solid ' + props.theme.colors.disabled
118
117
  : props.isChecked
119
118
  ? props.backgroundColor
120
- ? "1px solid " + props.backgroundColor
121
- : "1px solid " + props.theme.colors.green
122
- : "1px solid " + props.theme.colors.grey3}
119
+ ? '1px solid ' + props.backgroundColor
120
+ : '1px solid ' + props.theme.colors.green
121
+ : '1px solid ' + props.theme.colors.grey3}
123
122
  position: relative;
124
- cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
123
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
125
124
  width: ${(props) =>
126
- props.size === "medium"
127
- ? "50px"
128
- : props.size === "small"
129
- ? "29px"
130
- : "50px"};
125
+ props.size === 'medium'
126
+ ? '50px'
127
+ : props.size === 'small'
128
+ ? '29px'
129
+ : '50px'};
131
130
  height: ${(props) =>
132
- props.size === "medium"
133
- ? "24px"
134
- : props.size === "small"
135
- ? "16px"
136
- : "24px"};
131
+ props.size === 'medium'
132
+ ? '24px'
133
+ : props.size === 'small'
134
+ ? '16px'
135
+ : '24px'};
137
136
  border-radius: 100px;
138
137
 
139
138
  &:focus {
@@ -149,9 +148,9 @@ const ToggleWrapper = styled("span", toggleAttrs)`
149
148
  const backgroundAttrs = {
150
149
  backgroundColor: String,
151
150
  isChecked: Boolean,
152
- disabled: Boolean,
151
+ disabled: Boolean
153
152
  }
154
- const ToggleBackground = styled("span", backgroundAttrs)`
153
+ const ToggleBackground = styled('span', backgroundAttrs)`
155
154
  display: block;
156
155
  border-radius: 100px;
157
156
  height: 100%;
@@ -171,25 +170,25 @@ const toggleProps = {
171
170
  isChecked: Boolean,
172
171
  toggleColor: String,
173
172
  size: String,
174
- disabled: Boolean,
173
+ disabled: Boolean
175
174
  }
176
- const ToggleDot = styled("span", toggleProps)`
175
+ const ToggleDot = styled('span', toggleProps)`
177
176
  position: absolute;
178
177
  height: ${(props) =>
179
- props.size === "medium"
180
- ? "14px"
181
- : props.size === "small"
182
- ? "10px"
183
- : "14px"};
178
+ props.size === 'medium'
179
+ ? '14px'
180
+ : props.size === 'small'
181
+ ? '10px'
182
+ : '14px'};
184
183
  width: ${(props) =>
185
- props.size === "medium"
186
- ? "14px"
187
- : props.size === "small"
188
- ? "10px"
189
- : "14px"};
190
- left: 3px
184
+ props.size === 'medium'
185
+ ? '14px'
186
+ : props.size === 'small'
187
+ ? '10px'
188
+ : '14px'};
189
+ left: 3px;
191
190
  bottom: ${(props) =>
192
- props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
191
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
193
192
  background-color: ${(props) =>
194
193
  props.disabled
195
194
  ? props.theme.colors.disabled
@@ -202,33 +201,33 @@ const ToggleDot = styled("span", toggleProps)`
202
201
  transition: transform 0.4s ease;
203
202
  transform: ${(props) =>
204
203
  props.isChecked
205
- ? props.size === "medium"
206
- ? "translateX(25px)"
207
- : props.size === "small"
208
- ? "translateX(12px)"
209
- : "translateX(25px)"
210
- : "translateX(0)"};
204
+ ? props.size === 'medium'
205
+ ? 'translateX(25px)'
206
+ : props.size === 'small'
207
+ ? 'translateX(12px)'
208
+ : 'translateX(25px)'
209
+ : 'translateX(0)'};
211
210
 
212
211
  @media (max-width: ${(props) => props.theme.screen.mobile}) {
213
212
  height: 24px;
214
213
  width: 24px;
215
214
  transform: ${(props) =>
216
- props.isChecked ? "translateX(25px)" : "translateX(0)"};
215
+ props.isChecked ? 'translateX(25px)' : 'translateX(0)'};
217
216
  bottom: 8px;
218
217
  }
219
218
  `
220
219
 
221
220
  const labelAttrs = { hasInfoMessage: Boolean }
222
- const LabelContainer = styled("div", labelAttrs)`
221
+ const LabelContainer = styled('div', labelAttrs)`
223
222
  display: inline-grid;
224
223
  grid-template-columns: ${(props) =>
225
- props.hasInfoMessage ? "auto 1fr" : "auto"};
224
+ props.hasInfoMessage ? 'auto 1fr' : 'auto'};
226
225
  grid-gap: 12px;
227
226
  align-items: center;
228
227
  `
229
228
 
230
229
  export default {
231
- name: "toggle",
230
+ name: 'toggle',
232
231
  components: {
233
232
  Container,
234
233
  ToggleBackground,
@@ -237,52 +236,53 @@ export default {
237
236
  FlexWrapper,
238
237
  LabelText,
239
238
  InfoText,
240
- LabelContainer,
239
+ LabelContainer
241
240
  },
242
241
  props: {
243
242
  label: {
244
243
  required: false,
245
- default: "",
244
+ default: ''
246
245
  },
247
246
  isChecked: {
248
247
  required: true,
249
- default: false,
248
+ default: false
250
249
  },
251
250
  toggleColor: {
252
- required: false,
251
+ required: false
253
252
  },
254
253
  backgroundColor: {
255
- required: false,
254
+ required: false
256
255
  },
257
256
  size: {
258
257
  required: false,
259
- default: "small",
258
+ default: 'small'
260
259
  },
261
260
  labelAlign: {
262
261
  required: false,
263
- default: "right",
262
+ default: 'right'
264
263
  },
265
264
  fontColor: {
266
- required: false,
265
+ required: false
267
266
  },
268
267
  disabled: {
269
268
  required: false,
270
- default: false,
269
+ default: false
271
270
  },
272
271
  infoTextMessage: {
273
- required: false,
274
- },
275
- infoTextAlign: {
276
- required: false,
272
+ required: false
277
273
  },
274
+ dataId: {
275
+ type: String,
276
+ default: ''
277
+ }
278
278
  },
279
279
  methods: {
280
280
  onToggleChange() {
281
281
  if (this.disabled) {
282
282
  return
283
283
  }
284
- this.$emit("on-toggle-change", !this.isChecked)
285
- },
286
- },
284
+ this.$emit('on-toggle-change', !this.isChecked)
285
+ }
286
+ }
287
287
  }
288
288
  </script>
@@ -37,7 +37,7 @@ const ContentContainer = styled('div', contentAttrs)`
37
37
  visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
38
38
  `
39
39
 
40
- const pageAttrs = { isOpen: Boolean, backdrop: String,position:String }
40
+ const pageAttrs = { isOpen: Boolean, backdrop: String, position: String }
41
41
  const PageWrapper = styled('div', pageAttrs)`
42
42
  position: ${(props) => props.position}
43
43
  display: grid;
@@ -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,13 @@
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
+ />
10
+ </title-wrap>
3
11
  </template>
4
12
 
5
13
  <script>
@@ -10,25 +18,41 @@
10
18
  // color="red"
11
19
  // />
12
20
  import styled from "vue-styled-components"
21
+ import InfoText from "../infoText"
13
22
 
14
- const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
15
- const TitleText = styled("div", textAttrs)`
23
+ const wrapAttrs = { hasInfoText: Boolean }
24
+ const TitleWrap = styled("div", wrapAttrs)`
25
+ display: grid;
26
+ align-items: center;
27
+ grid-gap: 12px;
28
+ grid-template-columns: ${(props) =>
29
+ props.hasInfoText ? "auto auto 1fr" : "1fr"};
30
+ margin-bottom: 20px;
31
+ `
32
+
33
+ const titleAttrs = { color: String, fontSize: String, uppercase: Boolean }
34
+ const TitleText = styled('span', titleAttrs)`
16
35
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
36
  font-weight: bold;
18
37
  font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
19
38
  text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
20
- margin-bottom: 20px;
21
39
  `
22
40
 
23
41
  export default {
24
42
  name: "page-title",
25
43
  components: {
26
44
  TitleText,
45
+ TitleWrap,
46
+ InfoText
27
47
  },
28
48
  props: {
29
49
  text: {
30
50
  required: true,
31
51
  },
52
+ infoText: {
53
+ required: false,
54
+ default: null,
55
+ },
32
56
  color: {
33
57
  required: false,
34
58
  },
@@ -8,6 +8,7 @@
8
8
  <list-item
9
9
  v-if="!item.children"
10
10
  :key="idx"
11
+ :data-id="`sub_menu_settings_${item.key}`"
11
12
  :isActive="activeTab === item.key"
12
13
  @click="$emit('tab-click', { activeKey: item.key })"
13
14
  >
@@ -57,6 +58,7 @@
57
58
  <icon-container
58
59
  :isActive="false"
59
60
  :isButton="true"
61
+ data-id="button_settings_logout"
60
62
  @click="$emit('on-logout')"
61
63
  >
62
64
  <rotate-icon
@@ -134,11 +134,13 @@
134
134
  {{ !!item[option] ? item[option] : '-' }}
135
135
  </span>
136
136
  <template-button
137
+ :key="idx"
137
138
  @click.stop="onTemplateClick(item)"
138
139
  v-else-if="option === 'template' && item.has_template"
139
140
  >{{ $gettext('Use template...') }}</template-button
140
141
  >
141
142
  <no-template
143
+ :key="idx"
142
144
  v-else-if="option === 'template' && !item.has_template"
143
145
  >
144
146
  {{ $gettext('No main component template') }}
@@ -91,19 +91,12 @@ export const stringToNumber = ({
91
91
  return parseFloat(newVal)
92
92
  }
93
93
 
94
- export const numberToString = ({ value, numberPrecision = 0 }) => {
94
+ export const numberToString = ({ value, numberPrecision, minDecimals }) => {
95
+ const minimumRounding = minDecimals ? minDecimals : 0
95
96
  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]
104
- }
105
97
  return value.toLocaleString(langForLocaleString(), {
106
- minimumFractionDigits: minNumberPrecision,
107
- maximumFractionDigits: maxNumberPrecision
98
+ minimumFractionDigits: minimumRounding, // removing this for now. Why do we need this to be a minimum amount?
99
+ maximumFractionDigits:
100
+ numberPrecision < minimumRounding ? minimumRounding : numberPrecision
108
101
  })
109
102
  }