@eturnity/eturnity_reusable_components 8.19.8-EPDM-14690.4 → 8.19.8-EPDM-11600.11
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 +1 -1
- package/src/App.vue +1 -3
- package/src/assets/svgIcons/erase.svg +2 -3
- package/src/assets/theme.js +1 -79
- package/src/components/barchart/BottomFields.vue +36 -126
- package/src/components/barchart/composables/useAxisCalculations.js +1 -1
- package/src/components/barchart/composables/useChartData.js +1 -1
- package/src/components/barchart/composables/useTooltip.js +3 -28
- package/src/components/barchart/index.vue +28 -56
- package/src/components/barchart/styles/bottomFields.js +4 -18
- package/src/components/barchart/styles/chart.js +21 -15
- package/src/components/buttons/mainButton/index.vue +0 -2
- package/src/components/errorMessage/index.vue +1 -1
- package/src/components/icon/index.vue +2 -4
- package/src/components/infoCard/index.vue +3 -15
- package/src/components/infoCard/infoCard.spec.js +3 -3
- package/src/components/infoText/index.vue +31 -36
- package/src/components/inputs/inputNumber/InputNumber.stories.js +5 -5
- package/src/components/inputs/inputNumber/index.vue +11 -92
- package/src/components/pageSubtitle/index.vue +7 -1
- package/src/components/pageTitle/index.vue +1 -0
- package/src/DemoChart.vue +0 -424
- package/src/TestChart.vue +0 -229
- package/src/components/tag/proTag/index.vue +0 -19
@@ -17,8 +17,8 @@
|
|
17
17
|
/>
|
18
18
|
</ChartControlsWrapper>
|
19
19
|
<GraphSection :height="height" :width="width">
|
20
|
-
<YAxis :
|
21
|
-
<YAxisTitleWrapper v-if="yAxisTitle"
|
20
|
+
<YAxis :width="yAxisWidth">
|
21
|
+
<YAxisTitleWrapper v-if="yAxisTitle">
|
22
22
|
{{ yAxisTitle }}
|
23
23
|
</YAxisTitleWrapper>
|
24
24
|
<YAxisRow
|
@@ -30,15 +30,15 @@
|
|
30
30
|
)
|
31
31
|
"
|
32
32
|
>
|
33
|
-
<YAxisLabel>{{
|
33
|
+
<YAxisLabel>{{ label }}</YAxisLabel>
|
34
34
|
<YAxisLine :y-axis-width="yAxisWidth" />
|
35
35
|
</YAxisRow>
|
36
36
|
</YAxis>
|
37
37
|
|
38
38
|
<ScrollContainer
|
39
39
|
:class="`chart-scroll-container-${chartId}`"
|
40
|
-
:height="height"
|
41
40
|
:is-scrollable="isScrollable"
|
41
|
+
:height="height"
|
42
42
|
@scroll="handleChartScroll"
|
43
43
|
>
|
44
44
|
<ChartContent
|
@@ -51,6 +51,11 @@
|
|
51
51
|
<LoadingOverlay v-if="isLoading">
|
52
52
|
<Spinner size="60px" />
|
53
53
|
</LoadingOverlay>
|
54
|
+
<InfoCardContainer v-else-if="!isDataIssueMessageDisplayed">
|
55
|
+
<RCInfoCard align-items="center">
|
56
|
+
{{ dataIssueMessage }}
|
57
|
+
</RCInfoCard>
|
58
|
+
</InfoCardContainer>
|
54
59
|
<SelectionBox
|
55
60
|
v-if="selectionSize && isSelectionEnabled"
|
56
61
|
:bar-width="barWidth"
|
@@ -64,19 +69,19 @@
|
|
64
69
|
<BarsContainer>
|
65
70
|
<BarGroup
|
66
71
|
v-for="(item, index) in normalizedData"
|
67
|
-
:key="index"
|
68
72
|
:bar-width="barWidth"
|
69
73
|
class="bar-group"
|
70
74
|
:is-scrollable="isScrollable"
|
75
|
+
:key="index"
|
71
76
|
>
|
72
77
|
<BarWrapper>
|
73
78
|
<BarSegment
|
74
79
|
v-for="(segment, segIndex) in item.segments"
|
75
|
-
:key="segIndex"
|
76
80
|
class="bar-segment"
|
77
81
|
:gradient-from="getSegmentGradient(index, segment).from"
|
78
82
|
:gradient-to="getSegmentGradient(index, segment).to"
|
79
83
|
:height="`${segment.percentage}%`"
|
84
|
+
:key="segIndex"
|
80
85
|
:z-index="item.segments.length - segIndex"
|
81
86
|
@mouseenter="showTooltip(item, $event, series)"
|
82
87
|
@mouseleave="hideTooltip"
|
@@ -96,7 +101,7 @@
|
|
96
101
|
:left="tooltipStyle.left"
|
97
102
|
:top="tooltipStyle.top"
|
98
103
|
>
|
99
|
-
<slot :item="tooltipData" name="tooltip"
|
104
|
+
<slot :item="tooltipData" name="tooltip" />
|
100
105
|
<TooltipTextWrapper v-if="!slots.tooltip && tooltipData">
|
101
106
|
<template v-if="!series.length">
|
102
107
|
<TooltipText font-weight="500">{{ tooltipData.label }}</TooltipText>
|
@@ -128,11 +133,7 @@
|
|
128
133
|
:gradient-to="segment.gradientTo"
|
129
134
|
/>
|
130
135
|
<TooltipText>
|
131
|
-
{{
|
132
|
-
fieldMode === 'absolute' && showPercentageOnTooltip
|
133
|
-
? `${segment.valuePercentage}%`
|
134
|
-
: handleValueFormatter(segment.value)
|
135
|
-
}}
|
136
|
+
{{ handleValueFormatter(segment.value) }}
|
136
137
|
</TooltipText>
|
137
138
|
</TooltipRow>
|
138
139
|
</template>
|
@@ -163,9 +164,7 @@
|
|
163
164
|
:data="data"
|
164
165
|
:field-mode="fieldMode"
|
165
166
|
:is-chart-controls-shown-in-bottom="isChartControlsShown('bottom')"
|
166
|
-
:is-inputs-disabled="isLoading"
|
167
167
|
:is-scrollable="isScrollable"
|
168
|
-
:percentage-error-message="percentageErrorMessage"
|
169
168
|
:series="series"
|
170
169
|
:y-axis-width="yAxisWidth"
|
171
170
|
@input-blur="handleInputBlur"
|
@@ -177,13 +176,13 @@
|
|
177
176
|
</template>
|
178
177
|
|
179
178
|
<script setup>
|
180
|
-
import { useSlots, computed
|
179
|
+
import { useSlots, computed } from 'vue'
|
181
180
|
|
182
181
|
import ChartControls from './ChartControls'
|
183
182
|
import BottomFields from './BottomFields'
|
184
183
|
import SelectionBox from './SelectionBox'
|
184
|
+
import RCInfoCard from '../infoCard'
|
185
185
|
import Spinner from '../spinner'
|
186
|
-
import { numberToString } from '../../helpers/numberConverter'
|
187
186
|
|
188
187
|
import {
|
189
188
|
useTooltip,
|
@@ -217,6 +216,7 @@
|
|
217
216
|
TooltipGradientBox,
|
218
217
|
ChartControlsWrapper,
|
219
218
|
LoadingOverlay,
|
219
|
+
InfoCardContainer,
|
220
220
|
} from './styles/chart'
|
221
221
|
|
222
222
|
const props = defineProps({
|
@@ -253,6 +253,10 @@
|
|
253
253
|
type: String,
|
254
254
|
default: '',
|
255
255
|
},
|
256
|
+
valueFormatter: {
|
257
|
+
type: Function,
|
258
|
+
default: null,
|
259
|
+
},
|
256
260
|
isLegendShown: {
|
257
261
|
type: Boolean,
|
258
262
|
default: false,
|
@@ -299,14 +303,14 @@
|
|
299
303
|
type: Boolean,
|
300
304
|
default: false,
|
301
305
|
},
|
302
|
-
|
303
|
-
type: Boolean,
|
304
|
-
default: false,
|
305
|
-
},
|
306
|
-
percentageErrorMessage: {
|
306
|
+
dataIssueMessage: {
|
307
307
|
type: String,
|
308
308
|
default: '',
|
309
309
|
},
|
310
|
+
isDataIssueMessageDisplayed: {
|
311
|
+
type: Boolean,
|
312
|
+
default: false,
|
313
|
+
},
|
310
314
|
})
|
311
315
|
|
312
316
|
const generateChartId = () =>
|
@@ -389,40 +393,8 @@
|
|
389
393
|
}
|
390
394
|
|
391
395
|
const handleValueFormatter = (value) => {
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
value: formattedValue,
|
396
|
-
numberPrecision: 0,
|
397
|
-
minDecimals: 0,
|
398
|
-
})
|
399
|
-
} else if (value < 1000000) {
|
400
|
-
formattedValue = numberToString({
|
401
|
-
value: Number(formattedValue / 1000),
|
402
|
-
numberPrecision: 2,
|
403
|
-
minDecimals: 2,
|
404
|
-
})
|
405
|
-
} else {
|
406
|
-
formattedValue = numberToString({
|
407
|
-
value: Number(formattedValue / 1000000),
|
408
|
-
numberPrecision: 2,
|
409
|
-
minDecimals: 2,
|
410
|
-
})
|
411
|
-
}
|
412
|
-
if (value < 1000) {
|
413
|
-
return `${formattedValue} kWh`
|
414
|
-
} else if (value < 1000000) {
|
415
|
-
return `${formattedValue} MWh`
|
416
|
-
} else {
|
417
|
-
return `${formattedValue} GWh`
|
418
|
-
}
|
419
|
-
}
|
420
|
-
|
421
|
-
const getYAxisLabel = (label) => {
|
422
|
-
return numberToString({
|
423
|
-
value: label,
|
424
|
-
numberPrecision: 0,
|
425
|
-
minDecimals: 0,
|
426
|
-
})
|
396
|
+
return props.valueFormatter
|
397
|
+
? props.valueFormatter(Math.round(value))
|
398
|
+
: value
|
427
399
|
}
|
428
400
|
</script>
|
@@ -17,18 +17,18 @@ export const LabelsColumn = styled('div', { width: String })`
|
|
17
17
|
|
18
18
|
export const LabelRow = styled.div`
|
19
19
|
height: 32px;
|
20
|
-
padding-top: 5px;
|
21
20
|
font-size: 12px;
|
22
21
|
font-weight: 500;
|
23
22
|
color: ${(props) => props.theme.semanticColors.teal[600]};
|
24
23
|
display: flex;
|
25
|
-
align-items:
|
24
|
+
align-items: flex-start;
|
26
25
|
`
|
27
26
|
|
28
27
|
export const TotalRow = styled(LabelRow)``
|
29
28
|
|
30
29
|
export const FieldsContainer = styled.div`
|
31
30
|
flex: 1;
|
31
|
+
overflow-x: auto;
|
32
32
|
scrollbar-width: none;
|
33
33
|
|
34
34
|
&::-webkit-scrollbar {
|
@@ -59,22 +59,8 @@ export const InputGroup = styled('div', {
|
|
59
59
|
barWidth: Number,
|
60
60
|
isScrollable: Boolean,
|
61
61
|
})`
|
62
|
-
${(props) => (props.isScrollable ? 'min-width' : 'width')}
|
62
|
+
${(props) => (props.isScrollable ? 'min-width' : 'width')}:${(props) =>
|
63
|
+
props.barWidth}px;
|
63
64
|
display: flex;
|
64
65
|
justify-content: center;
|
65
|
-
position: relative;
|
66
|
-
|
67
|
-
input[readonly] {
|
68
|
-
border: 1px solid ${(props) => props.theme.colors.grey4} !important;
|
69
|
-
}
|
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
66
|
`
|
@@ -16,12 +16,9 @@ export const GraphSection = styled('div', { width: String, height: String })`
|
|
16
16
|
display: flex;
|
17
17
|
`
|
18
18
|
|
19
|
-
export const YAxis = styled('div', { width: String
|
19
|
+
export const YAxis = styled('div', { width: String })`
|
20
20
|
width: ${(props) => props.width};
|
21
|
-
display: flex;
|
22
|
-
flex-direction: column;
|
23
21
|
position: relative;
|
24
|
-
height: ${(props) => props.height};
|
25
22
|
`
|
26
23
|
|
27
24
|
export const YAxisRow = styled('div', { percentage: Number })`
|
@@ -57,18 +54,19 @@ export const YAxisLine = styled('div', { yAxisWidth: String })`
|
|
57
54
|
transform: translateY(-50%);
|
58
55
|
`
|
59
56
|
|
60
|
-
export const YAxisTitleWrapper = styled('div'
|
61
|
-
position: absolute;
|
62
|
-
left: -66px;
|
63
|
-
top: ${(props) => props.height};
|
64
|
-
transform: rotate(-90deg) translateX(50%);
|
65
|
-
transform-origin: right;
|
57
|
+
export const YAxisTitleWrapper = styled('div')`
|
66
58
|
font-size: 12px;
|
67
|
-
|
68
|
-
|
69
|
-
align-items: center;
|
59
|
+
font-weight: 500;
|
60
|
+
color: ${(props) => props.theme.semanticColors.grey[700]};
|
70
61
|
white-space: nowrap;
|
71
|
-
|
62
|
+
height: 0;
|
63
|
+
width: 0;
|
64
|
+
display: flex;
|
65
|
+
align-items: flex-start;
|
66
|
+
justify-content: center;
|
67
|
+
position: absolute;
|
68
|
+
top: 50%;
|
69
|
+
transform: rotate(-90deg);
|
72
70
|
`
|
73
71
|
|
74
72
|
export const ScrollContainer = styled('div', {
|
@@ -127,7 +125,6 @@ export const BarWrapper = styled.div`
|
|
127
125
|
height: 100%;
|
128
126
|
width: 100%;
|
129
127
|
position: relative;
|
130
|
-
overflow: hidden;
|
131
128
|
`
|
132
129
|
|
133
130
|
export const BarSegment = styled('div', {
|
@@ -271,3 +268,12 @@ export const LoadingOverlay = styled('div')`
|
|
271
268
|
align-items: center;
|
272
269
|
z-index: 2;
|
273
270
|
`
|
271
|
+
|
272
|
+
export const InfoCardContainer = styled('div')`
|
273
|
+
position: absolute;
|
274
|
+
top: 50%;
|
275
|
+
left: 50%;
|
276
|
+
transform: translate(-50%, -50%);
|
277
|
+
max-width: 500px;
|
278
|
+
z-index: 2;
|
279
|
+
`
|
@@ -240,8 +240,6 @@
|
|
240
240
|
return this.isDisabled
|
241
241
|
? this.theme.mainButton[this.appTheme][this.type][this.variant]
|
242
242
|
.disabled.textColor
|
243
|
-
: this.iconColor
|
244
|
-
? this.iconColor
|
245
243
|
: this.theme.mainButton[this.appTheme][this.type][this.variant]
|
246
244
|
.default.textColor
|
247
245
|
},
|
@@ -208,11 +208,9 @@
|
|
208
208
|
!props.disableHover &&
|
209
209
|
`
|
210
210
|
&:hover svg path:not(.fix, .isStrokePath) {
|
211
|
-
${`${props.fillType}: ${
|
212
|
-
props.theme.colors[props.hoveredColor] || props.color
|
213
|
-
};`}
|
211
|
+
${`${props.fillType}: ${props.hoveredColor || props.color};`}
|
214
212
|
&:hover svg isStrokePath:not(.fix) {
|
215
|
-
${`stroke: ${props.
|
213
|
+
${`stroke: ${props.hoveredColor || props.color};`}
|
216
214
|
}
|
217
215
|
&:hover + div {
|
218
216
|
background-color: ${props.hoveredColor};
|
@@ -73,12 +73,7 @@
|
|
73
73
|
type: {
|
74
74
|
required: false,
|
75
75
|
type: String,
|
76
|
-
default: '
|
77
|
-
validator(value) {
|
78
|
-
return ['info_simple', 'warning', 'error_minor', 'info'].includes(
|
79
|
-
value
|
80
|
-
)
|
81
|
-
},
|
76
|
+
default: 'info',
|
82
77
|
},
|
83
78
|
minWidth: {
|
84
79
|
required: false,
|
@@ -117,11 +112,8 @@
|
|
117
112
|
},
|
118
113
|
},
|
119
114
|
computed: {
|
120
|
-
isInfoSimple() {
|
121
|
-
// this property is used for tests
|
122
|
-
return this.type === 'info_simple'
|
123
|
-
},
|
124
115
|
isInfo() {
|
116
|
+
// this property is used for tests
|
125
117
|
return this.type === 'info'
|
126
118
|
},
|
127
119
|
isWarning() {
|
@@ -156,13 +148,9 @@
|
|
156
148
|
stylesCollection.borderStyle = 'dashed'
|
157
149
|
stylesCollection.borderColor = theme.colors.grey4
|
158
150
|
stylesCollection.iconColor = theme.colors.red
|
159
|
-
} else
|
151
|
+
} else {
|
160
152
|
stylesCollection.borderStyle = 'dashed'
|
161
153
|
stylesCollection.borderColor = theme.colors.grey4
|
162
|
-
} else {
|
163
|
-
stylesCollection.color = theme.semanticColors.teal[800]
|
164
|
-
stylesCollection.backgroundColor = theme.semanticColors.blue[300]
|
165
|
-
stylesCollection.iconColor = theme.semanticColors.teal[800]
|
166
154
|
}
|
167
155
|
|
168
156
|
return stylesCollection
|
@@ -45,19 +45,19 @@ describe('RCInfoCard.vue', () => {
|
|
45
45
|
},
|
46
46
|
})
|
47
47
|
|
48
|
-
expect(wrapper.vm.
|
48
|
+
expect(wrapper.vm.isInfo).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.
|
54
|
+
expect(wrapper.vm.isInfo).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.
|
60
|
+
expect(wrapper.vm.isInfo).toBe(false)
|
61
61
|
expect(wrapper.vm.isWarning).toBe(false)
|
62
62
|
expect(wrapper.vm.isErrorMinor).toBe(true)
|
63
63
|
})
|
@@ -15,40 +15,37 @@
|
|
15
15
|
:is-disabled="isDisabled"
|
16
16
|
:padding="padding"
|
17
17
|
>
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</LabelWrapper>
|
47
|
-
</template>
|
48
|
-
<slot name="trigger"></slot>
|
18
|
+
<LabelWrapper
|
19
|
+
v-if="labelText && labelAlign === 'left'"
|
20
|
+
:color="iconColor || computedIconColor"
|
21
|
+
:size="labelSize"
|
22
|
+
>
|
23
|
+
{{ labelText }}
|
24
|
+
</LabelWrapper>
|
25
|
+
<Dot
|
26
|
+
v-if="type === 'dot'"
|
27
|
+
:color="dotColor"
|
28
|
+
data-test-id="infoText_dot"
|
29
|
+
/>
|
30
|
+
<IconComponent
|
31
|
+
v-else-if="!noIcon"
|
32
|
+
:color="iconColor || computedIconColor"
|
33
|
+
:cursor="isDisabled ? 'not-allowed' : 'pointer'"
|
34
|
+
:disabled="isDisabled"
|
35
|
+
:hovered-color="iconColor || computedIconColor"
|
36
|
+
:name="iconName"
|
37
|
+
:size="size"
|
38
|
+
/>
|
39
|
+
<LabelWrapper
|
40
|
+
v-if="labelText && labelAlign === 'right'"
|
41
|
+
:color="iconColor || computedIconColor"
|
42
|
+
:size="labelSize"
|
43
|
+
>
|
44
|
+
{{ labelText }}
|
45
|
+
</LabelWrapper>
|
49
46
|
</IconWrapper>
|
50
47
|
</div>
|
51
|
-
<Teleport v-if="isVisible
|
48
|
+
<Teleport v-if="isVisible" to="body">
|
52
49
|
<TextWrapper data-test-id="info_text_wrapper" :style="wrapperStyle">
|
53
50
|
<TextOverlay
|
54
51
|
ref="infoBox"
|
@@ -230,7 +227,7 @@
|
|
230
227
|
},
|
231
228
|
infoPosition: {
|
232
229
|
required: false,
|
233
|
-
default:
|
230
|
+
default: 'bottom',
|
234
231
|
type: String,
|
235
232
|
},
|
236
233
|
maxWidth: {
|
@@ -366,9 +363,7 @@
|
|
366
363
|
{ position: 'left', space: spaceLeft },
|
367
364
|
].sort((a, b) => b.space - a.space)
|
368
365
|
|
369
|
-
const bestPosition =
|
370
|
-
? props.infoPosition
|
371
|
-
: positions[0].position
|
366
|
+
const bestPosition = positions[0].position
|
372
367
|
|
373
368
|
let top, left, arrowPosition
|
374
369
|
|
@@ -3,15 +3,15 @@ import InputNumber from './index.vue'
|
|
3
3
|
export default {
|
4
4
|
title: 'InputNumber',
|
5
5
|
component: InputNumber,
|
6
|
-
// argTypes: {},
|
7
6
|
}
|
8
7
|
|
9
|
-
const Template = (args
|
8
|
+
const Template = (args) => ({
|
10
9
|
// Components used in your story `template` are defined in the `components` object
|
11
10
|
components: { InputNumber },
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
setup() {
|
12
|
+
return { args: args }
|
13
|
+
},
|
14
|
+
template: `<InputNumber v-bind="args" />`,
|
15
15
|
|
16
16
|
// import InputNumber from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumber"
|
17
17
|
// How to use:
|