@eturnity/eturnity_reusable_components 8.16.9-EPDM-14690.2 → 8.16.9-EPDM-14690.3

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": "8.16.9-EPDM-14690.2",
3
+ "version": "8.16.9-EPDM-14690.3",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -33,10 +33,8 @@
33
33
  <InputNumber
34
34
  :allow-negative="false"
35
35
  :disabled="isInputsDisabled"
36
- :error-message="null"
37
36
  input-height="36px"
38
- :is-border-error-only="true"
39
- :is-error="
37
+ :is-info-border="
40
38
  fieldMode === 'percentage'
41
39
  ? calculatePercentageTotal(item.label) !== 100
42
40
  : false
@@ -83,10 +81,9 @@
83
81
  :is-scrollable="isScrollable"
84
82
  >
85
83
  <InputNumber
86
- :error-message="$gettext('load_profile_not_add_up_to_100')"
87
84
  input-height="36px"
88
85
  :is-border-error-only="true"
89
- :is-error="
86
+ :is-info-border="
90
87
  fieldMode === 'percentage'
91
88
  ? calculatePercentageTotal(item.label) !== 100
92
89
  : false
@@ -127,11 +124,22 @@
127
124
  </FieldsWrapper>
128
125
  </FieldsContainer>
129
126
  </Container>
127
+ <InfoCardContainer
128
+ v-if="hasAnySegmentNotTotatTo100Percent && fieldMode === 'percentage'"
129
+ :yAxisWidth="yAxisWidth"
130
+ >
131
+ <InfoCard align-items="center" type="info">
132
+ <InfoCardBody>
133
+ {{ $gettext('load_profile_not_add_up_to_100') }}
134
+ </InfoCardBody>
135
+ </InfoCard>
136
+ </InfoCardContainer>
130
137
  </template>
131
138
 
132
139
  <script setup>
133
- import { ref, watch, watchEffect, onMounted } from 'vue'
140
+ import { ref, computed, watchEffect } from 'vue'
134
141
  import InputNumber from '../inputs/inputNumber'
142
+ import InfoCard from '../infoCard'
135
143
 
136
144
  import {
137
145
  Container,
@@ -143,6 +151,8 @@
143
151
  InputRow,
144
152
  TotalInputRow,
145
153
  InputGroup,
154
+ InfoCardContainer,
155
+ InfoCardBody,
146
156
  } from './styles/bottomFields'
147
157
 
148
158
  const props = defineProps({
@@ -345,6 +355,12 @@
345
355
  }
346
356
  }
347
357
 
358
+ const hasAnySegmentNotTotatTo100Percent = computed(() => {
359
+ return props.data.some((d) => {
360
+ return calculatePercentageTotal(d.label) !== 100
361
+ })
362
+ })
363
+
348
364
  const handleFieldsScroll = (event) => {
349
365
  emit('sync-scroll', event.target.scrollLeft)
350
366
  }
@@ -68,3 +68,13 @@ export const InputGroup = styled('div', {
68
68
  border: 1px solid ${(props) => props.theme.colors.grey4} !important;
69
69
  }
70
70
  `
71
+
72
+ export const InfoCardContainer = styled('div', { yAxisWidth: String })`
73
+ margin-left: ${(props) => props.yAxisWidth};
74
+ padding: 12px;
75
+ margin-top: 12px;
76
+ `
77
+
78
+ export const InfoCardBody = styled.div`
79
+ padding: 8px 0;
80
+ `
@@ -73,7 +73,12 @@
73
73
  type: {
74
74
  required: false,
75
75
  type: String,
76
- default: 'info',
76
+ default: 'info_simple',
77
+ validator(value) {
78
+ return ['info_simple', 'warning', 'error_minor', 'info'].includes(
79
+ value
80
+ )
81
+ },
77
82
  },
78
83
  minWidth: {
79
84
  required: false,
@@ -112,8 +117,11 @@
112
117
  },
113
118
  },
114
119
  computed: {
115
- isInfo() {
120
+ isInfoSimple() {
116
121
  // this property is used for tests
122
+ return this.type === 'info_simple'
123
+ },
124
+ isInfo() {
117
125
  return this.type === 'info'
118
126
  },
119
127
  isWarning() {
@@ -144,9 +152,13 @@
144
152
  stylesCollection.borderStyle = 'dashed'
145
153
  stylesCollection.borderColor = theme.colors.pureRed
146
154
  stylesCollection.iconColor = theme.colors.pureRed
147
- } else {
155
+ } else if (this.isInfoSimple) {
148
156
  stylesCollection.borderStyle = 'dashed'
149
157
  stylesCollection.borderColor = theme.colors.grey4
158
+ } else {
159
+ stylesCollection.color = theme.semanticColors.teal[800]
160
+ stylesCollection.backgroundColor = theme.semanticColors.blue[300]
161
+ stylesCollection.iconColor = theme.semanticColors.teal[800]
150
162
  }
151
163
 
152
164
  return stylesCollection
@@ -45,19 +45,19 @@ describe('RCInfoCard.vue', () => {
45
45
  },
46
46
  })
47
47
 
48
- expect(wrapper.vm.isInfo).toBe(true)
48
+ expect(wrapper.vm.isInfoSimple).toBe(true)
49
49
  expect(wrapper.vm.isWarning).toBe(false)
50
50
  expect(wrapper.vm.isErrorMinor).toBe(false)
51
51
 
52
52
  await wrapper.setProps({ type: 'warning' })
53
53
 
54
- expect(wrapper.vm.isInfo).toBe(false)
54
+ expect(wrapper.vm.isInfoSimple).toBe(false)
55
55
  expect(wrapper.vm.isWarning).toBe(true)
56
56
  expect(wrapper.vm.isErrorMinor).toBe(false)
57
57
 
58
58
  await wrapper.setProps({ type: 'error_minor' })
59
59
 
60
- expect(wrapper.vm.isInfo).toBe(false)
60
+ expect(wrapper.vm.isInfoSimple).toBe(false)
61
61
  expect(wrapper.vm.isWarning).toBe(false)
62
62
  expect(wrapper.vm.isErrorMinor).toBe(true)
63
63
  })
@@ -53,6 +53,7 @@
53
53
  :is-border-error-only="isBorderErrorOnly"
54
54
  :is-disabled="disabled"
55
55
  :is-error="isError"
56
+ :is-info-border="isInfoBorder"
56
57
  :is-interactive="isInteractive"
57
58
  :min-width="minWidth"
58
59
  :no-border="noBorder"
@@ -210,6 +211,7 @@
210
211
  showArrowControls: Boolean,
211
212
  readOnly: Boolean,
212
213
  isBorderErrorOnly: Boolean,
214
+ isInfoBorder: Boolean,
213
215
  }
214
216
 
215
217
  const Container = styled('div', inputProps)`
@@ -222,7 +224,9 @@
222
224
 
223
225
  const InputContainer = styled('input', inputProps)`
224
226
  border: ${(props) =>
225
- props.isError
227
+ props.isInfoBorder
228
+ ? '1px solid ' + props.theme.semanticColors.blue[500]
229
+ : props.isError
226
230
  ? '1px solid ' + props.theme.colors.red
227
231
  : props.noBorder
228
232
  ? 'none'
@@ -708,6 +712,10 @@
708
712
  type: Boolean,
709
713
  default: false,
710
714
  },
715
+ isInfoBorder: {
716
+ type: Boolean,
717
+ default: false,
718
+ },
711
719
  },
712
720
  data() {
713
721
  return {