@eturnity/eturnity_reusable_components 7.48.1-EPDM-12680.11 → 7.48.1-dev-14.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 +3 -2
- package/src/assets/theme.js +1 -0
- package/src/components/buttons/buttonIcon/index.vue +1 -3
- package/src/components/buttons/mainButton/index.vue +0 -10
- package/src/components/icon/index.vue +0 -1
- package/src/components/infoCard/InfoCard.stories.js +170 -0
- package/src/components/infoCard/defaultProps.js +7 -0
- package/src/components/infoCard/index.vue +107 -22
- package/src/components/infoCard/infoCard.spec.js +64 -0
- package/src/components/infoText/index.vue +125 -289
- package/src/components/inputs/inputNumber/index.vue +11 -185
- package/src/components/inputs/inputText/index.vue +2 -23
- package/src/components/inputs/radioButton/defaultProps.js +0 -2
- package/src/components/inputs/radioButton/index.vue +6 -27
- package/src/components/inputs/radioButton/radioButton.spec.js +62 -99
- package/src/components/inputs/select/index.vue +29 -69
- package/src/components/inputs/select/option/index.vue +2 -11
- package/src/components/markerItem/index.vue +1 -8
- package/src/components/modals/modal/index.vue +9 -3
- package/src/components/sideMenu/index.vue +12 -3
- package/src/components/spinner/index.vue +0 -11
- package/src/components/tables/mainTable/index.vue +12 -4
- package/src/assets/svgIcons/collapse_all.svg +0 -4
- package/src/assets/svgIcons/hybrid.svg +0 -4
- package/src/assets/svgIcons/module.svg +0 -3
- package/src/assets/svgIcons/move_down.svg +0 -3
- package/src/assets/svgIcons/move_up.svg +0 -3
- package/src/assets/svgIcons/optimizer.svg +0 -6
- package/src/assets/svgIcons/string_design.svg +0 -5
- package/src/components/infoText/placeholder.vue +0 -225
- package/src/components/stringDesign/DropdownMenu/index.vue +0 -715
@@ -1,715 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<PageContainer>
|
3
|
-
<PageTitleContainer>
|
4
|
-
<SectionTitleText>{{ $gettext('inverters') }}</SectionTitleText>
|
5
|
-
<ButtonIcon
|
6
|
-
custom-color="black"
|
7
|
-
:icon-name="hasExpandedSection ? 'collapse_all' : 'expand'"
|
8
|
-
:text="$gettext(hasExpandedSection ? 'collapse_all' : 'expand_all')"
|
9
|
-
@click="toggleAllSections"
|
10
|
-
/>
|
11
|
-
</PageTitleContainer>
|
12
|
-
<SectionContainer v-for="(item, index) in dataList" :key="item.inverterId">
|
13
|
-
<TopContainer>
|
14
|
-
<LeftContainer>
|
15
|
-
<TitleContainer>
|
16
|
-
<IconWrapper size="36px" @click="toggleSection(item.inverterId)">
|
17
|
-
<RCIcon
|
18
|
-
color="white"
|
19
|
-
:name="isExpanded(item.inverterId) ? 'arrow_up' : 'arrow_down'"
|
20
|
-
size="10px"
|
21
|
-
/>
|
22
|
-
</IconWrapper>
|
23
|
-
<TextContainer>
|
24
|
-
<TitleText :title="item.model"
|
25
|
-
>{{
|
26
|
-
item.type === 'optimizer' && item.quantity
|
27
|
-
? item.quantity + ' x'
|
28
|
-
: ''
|
29
|
-
}}
|
30
|
-
{{ item.model }}</TitleText
|
31
|
-
>
|
32
|
-
<TitleSubText
|
33
|
-
>{{ item.brandName }} |
|
34
|
-
<ContainerValue v-if="item.getkWp() > 1">
|
35
|
-
{{
|
36
|
-
numberToString({
|
37
|
-
value: item.getkWp(),
|
38
|
-
numberPrecision: 2,
|
39
|
-
})
|
40
|
-
}}
|
41
|
-
kWp
|
42
|
-
</ContainerValue>
|
43
|
-
<ContainerValue v-else>
|
44
|
-
{{
|
45
|
-
numberToString({
|
46
|
-
value: 1000 * item.getkWp(),
|
47
|
-
numberPrecision: 2,
|
48
|
-
minDecimals: 2,
|
49
|
-
})
|
50
|
-
}}
|
51
|
-
Wp
|
52
|
-
</ContainerValue></TitleSubText
|
53
|
-
>
|
54
|
-
</TextContainer>
|
55
|
-
</TitleContainer>
|
56
|
-
<MarkersContainer>
|
57
|
-
<MarkerItem
|
58
|
-
v-if="item.mppts.length"
|
59
|
-
:background-color="isTargetRatioInRange(item) ? 'green' : 'red'"
|
60
|
-
>{{
|
61
|
-
numberToString({
|
62
|
-
value: 100 * item.getTargetRatio(),
|
63
|
-
numberPrecision: 2,
|
64
|
-
minDecimals: 0,
|
65
|
-
})
|
66
|
-
}}%</MarkerItem
|
67
|
-
>
|
68
|
-
<MarkerItem>
|
69
|
-
<span
|
70
|
-
:title="
|
71
|
-
item.hasTemplate
|
72
|
-
? item.company_product_template_name
|
73
|
-
? item.company_product_template_name
|
74
|
-
: $gettext('no_template_selected')
|
75
|
-
: $gettext('no_template')
|
76
|
-
"
|
77
|
-
>
|
78
|
-
{{
|
79
|
-
item.hasTemplate
|
80
|
-
? item.company_product_template_name
|
81
|
-
? item.company_product_template_name
|
82
|
-
: $gettext('no_template_selected')
|
83
|
-
: $gettext('no_template')
|
84
|
-
}}
|
85
|
-
</span>
|
86
|
-
</MarkerItem>
|
87
|
-
<MarkerItem>
|
88
|
-
<RCIcon
|
89
|
-
color="white"
|
90
|
-
:name="getIconName(item.type)"
|
91
|
-
size="14px"
|
92
|
-
/>
|
93
|
-
<div>{{ getTypeName(item.type) }}</div>
|
94
|
-
</MarkerItem>
|
95
|
-
</MarkersContainer>
|
96
|
-
<IconsContainer>
|
97
|
-
<IconWrapper>
|
98
|
-
<RCIcon
|
99
|
-
color="red"
|
100
|
-
cursor="pointer"
|
101
|
-
name="delete"
|
102
|
-
size="14px"
|
103
|
-
@click="$emit('on-delete', item)"
|
104
|
-
/>
|
105
|
-
</IconWrapper>
|
106
|
-
<IconWrapper @click="$emit('on-edit', item)">
|
107
|
-
<RCIcon
|
108
|
-
color="white"
|
109
|
-
cursor="pointer"
|
110
|
-
name="edit_button"
|
111
|
-
size="14px"
|
112
|
-
/>
|
113
|
-
</IconWrapper>
|
114
|
-
<IconWrapper>
|
115
|
-
<RCIcon
|
116
|
-
color="white"
|
117
|
-
cursor="pointer"
|
118
|
-
name="document"
|
119
|
-
size="14px"
|
120
|
-
@click="$emit('on-datasheet', item)"
|
121
|
-
/>
|
122
|
-
</IconWrapper>
|
123
|
-
</IconsContainer>
|
124
|
-
</LeftContainer>
|
125
|
-
<SortingContainer v-if="dataList.length > 1">
|
126
|
-
<SortingIconWrapper
|
127
|
-
:data-test-id="'move_up_' + index"
|
128
|
-
:is-disabled="index === 0"
|
129
|
-
@click="index > 0 && handleMoveClick('up', index)"
|
130
|
-
>
|
131
|
-
<RCIcon
|
132
|
-
:color="index === 0 ? 'grey6' : 'grey3'"
|
133
|
-
:cursor="index === 0 ? 'not-allowed' : 'pointer'"
|
134
|
-
name="move_up"
|
135
|
-
size="14px"
|
136
|
-
/>
|
137
|
-
</SortingIconWrapper>
|
138
|
-
<SortingIconWrapper
|
139
|
-
:data-test-id="'move_down_' + index"
|
140
|
-
:is-disabled="index === dataList.length - 1"
|
141
|
-
@click="
|
142
|
-
index < dataList.length - 1 && handleMoveClick('down', index)
|
143
|
-
"
|
144
|
-
>
|
145
|
-
<RCIcon
|
146
|
-
:color="index === dataList.length - 1 ? 'grey6' : 'grey3'"
|
147
|
-
:cursor="
|
148
|
-
index === dataList.length - 1 ? 'not-allowed' : 'pointer'
|
149
|
-
"
|
150
|
-
name="move_down"
|
151
|
-
size="14px"
|
152
|
-
/>
|
153
|
-
</SortingIconWrapper>
|
154
|
-
</SortingContainer>
|
155
|
-
</TopContainer>
|
156
|
-
<BoxContainer
|
157
|
-
v-for="mppt in item.mppts"
|
158
|
-
v-show="isExpanded(item.inverterId)"
|
159
|
-
:key="mppt.mpptId"
|
160
|
-
>
|
161
|
-
<BoxTitleWrapper>
|
162
|
-
<IconWrapper
|
163
|
-
margin-left="4px"
|
164
|
-
size="8px"
|
165
|
-
@click="toggleMppt(mppt.mpptId)"
|
166
|
-
>
|
167
|
-
<RCIcon
|
168
|
-
color="white"
|
169
|
-
cursor="pointer"
|
170
|
-
:name="isMpptExpanded(mppt.mpptId) ? 'arrow_up' : 'arrow_down'"
|
171
|
-
size="10px"
|
172
|
-
/>
|
173
|
-
</IconWrapper>
|
174
|
-
<BoxTitleText>{{ mppt.name }}</BoxTitleText>
|
175
|
-
<BoxIconsContainer>
|
176
|
-
<BoxIconWrapper>
|
177
|
-
<RCIcon
|
178
|
-
color="white"
|
179
|
-
cursor="pointer"
|
180
|
-
name="string_design"
|
181
|
-
size="11px"
|
182
|
-
/>
|
183
|
-
<div>
|
184
|
-
{{ mppt.strings.length }}/{{ item.availableMPPTs?.length }}
|
185
|
-
</div>
|
186
|
-
</BoxIconWrapper>
|
187
|
-
<BoxIconWrapper>
|
188
|
-
<RCIcon
|
189
|
-
color="white"
|
190
|
-
cursor="pointer"
|
191
|
-
name="panels_tool"
|
192
|
-
size="11px"
|
193
|
-
/>
|
194
|
-
<div>{{ getNumberOfMpptModules(mppt.strings) }}</div>
|
195
|
-
</BoxIconWrapper>
|
196
|
-
</BoxIconsContainer>
|
197
|
-
</BoxTitleWrapper>
|
198
|
-
<div v-show="isMpptExpanded(mppt.mpptId)">
|
199
|
-
<StringBox v-for="string in mppt.strings" :key="string.id">
|
200
|
-
<StringColorContainer :background-color="string.color" />
|
201
|
-
<StringContainer>
|
202
|
-
<div>{{ string.name }}</div>
|
203
|
-
<StringIconContainer>
|
204
|
-
<div>{{ string.modules.length }}</div>
|
205
|
-
<RCIcon color="white" name="module" size="14px" />
|
206
|
-
</StringIconContainer>
|
207
|
-
</StringContainer>
|
208
|
-
</StringBox>
|
209
|
-
</div>
|
210
|
-
</BoxContainer>
|
211
|
-
<BoxContainer
|
212
|
-
v-if="item.storageSystem && Object.keys(item.storageSystem).length > 0"
|
213
|
-
v-show="isExpanded(item.inverterId)"
|
214
|
-
:key="item.storageSystem.storage_system_id"
|
215
|
-
>
|
216
|
-
<BoxTitleWrapper>
|
217
|
-
<IconWrapper
|
218
|
-
margin-left="4px"
|
219
|
-
size="8px"
|
220
|
-
@click="toggleMppt(item.storageSystem.storage_system_id)"
|
221
|
-
>
|
222
|
-
<RCIcon
|
223
|
-
color="white"
|
224
|
-
cursor="pointer"
|
225
|
-
:name="
|
226
|
-
isMpptExpanded(item.storageSystem.storage_system_id)
|
227
|
-
? 'arrow_up'
|
228
|
-
: 'arrow_down'
|
229
|
-
"
|
230
|
-
size="10px"
|
231
|
-
/>
|
232
|
-
</IconWrapper>
|
233
|
-
<BoxTitleText>{{ $gettext('battery') }}</BoxTitleText>
|
234
|
-
</BoxTitleWrapper>
|
235
|
-
<div v-show="isMpptExpanded(item.storageSystem.storage_system_id)">
|
236
|
-
<BatteryBox>
|
237
|
-
<RCIcon color="white" name="battery" size="14px" />
|
238
|
-
<BatteryDetailsContainer>
|
239
|
-
<BatteryType>{{ item.storageSystem.brand_name }}</BatteryType>
|
240
|
-
<BatteryModel>{{ item.storageSystem.model }}</BatteryModel>
|
241
|
-
</BatteryDetailsContainer>
|
242
|
-
<BatteryValue>
|
243
|
-
{{
|
244
|
-
numberToString({
|
245
|
-
value: item.storageSystem.nominal_capacity_kWh,
|
246
|
-
numberPrecision: 2,
|
247
|
-
minDecimals: 0,
|
248
|
-
})
|
249
|
-
}}
|
250
|
-
kWh
|
251
|
-
</BatteryValue>
|
252
|
-
</BatteryBox>
|
253
|
-
</div>
|
254
|
-
</BoxContainer>
|
255
|
-
</SectionContainer>
|
256
|
-
<DividerContainer v-if="batteryData.length" />
|
257
|
-
<UnassignedContainer v-if="batteryData.length">
|
258
|
-
<SectionTitleText>{{ $gettext('battery_information') }}</SectionTitleText>
|
259
|
-
<BatteryBox
|
260
|
-
v-for="battery in batteryData"
|
261
|
-
:key="battery.id"
|
262
|
-
:is-unassigned="true"
|
263
|
-
>
|
264
|
-
<RCIcon color="black" name="battery" size="14px" />
|
265
|
-
<BatteryDetailsContainer>
|
266
|
-
<UnassignedType>{{ battery.brand_name }}</UnassignedType>
|
267
|
-
<UnassignedModel>{{ battery.model }}</UnassignedModel>
|
268
|
-
</BatteryDetailsContainer>
|
269
|
-
<BatteryValue>
|
270
|
-
{{
|
271
|
-
numberToString({
|
272
|
-
value: battery.nominal_capacity_kWh,
|
273
|
-
numberPrecision: 2,
|
274
|
-
minDecimals: 0,
|
275
|
-
})
|
276
|
-
}}
|
277
|
-
kWh
|
278
|
-
</BatteryValue>
|
279
|
-
</BatteryBox>
|
280
|
-
</UnassignedContainer>
|
281
|
-
</PageContainer>
|
282
|
-
</template>
|
283
|
-
|
284
|
-
<script>
|
285
|
-
// import DropdownMenu from '@eturnity/eturnity_reusable_components/src/components/stringDesign/DropdownMenu'
|
286
|
-
import styled from 'vue3-styled-components'
|
287
|
-
import RCIcon from '../../icon'
|
288
|
-
import ButtonIcon from '../../buttons/buttonIcon'
|
289
|
-
import { numberToString } from '../../../helpers/numberConverter'
|
290
|
-
|
291
|
-
const PageContainer = styled.div`
|
292
|
-
position: relative;
|
293
|
-
`
|
294
|
-
|
295
|
-
const SectionContainer = styled.div`
|
296
|
-
&:not(:last-child) {
|
297
|
-
margin-bottom: 8px;
|
298
|
-
}
|
299
|
-
background-color: ${(props) => props.theme.colors.black};
|
300
|
-
padding: 8px;
|
301
|
-
border-radius: 4px;
|
302
|
-
color: ${(props) => props.theme.colors.white};
|
303
|
-
`
|
304
|
-
|
305
|
-
const TitleContainer = styled.div`
|
306
|
-
display: flex;
|
307
|
-
align-items: center;
|
308
|
-
`
|
309
|
-
|
310
|
-
const IconsContainer = styled.div`
|
311
|
-
display: flex;
|
312
|
-
align-items: center;
|
313
|
-
margin-left: 36px;
|
314
|
-
`
|
315
|
-
|
316
|
-
const TextContainer = styled.div`
|
317
|
-
display: grid;
|
318
|
-
`
|
319
|
-
|
320
|
-
const TitleText = styled.div`
|
321
|
-
font-size: 14px;
|
322
|
-
white-space: nowrap;
|
323
|
-
overflow: hidden;
|
324
|
-
text-overflow: ellipsis;
|
325
|
-
`
|
326
|
-
|
327
|
-
const TitleSubText = styled.div`
|
328
|
-
font-size: 12px;
|
329
|
-
display: flex;
|
330
|
-
gap: 4px;
|
331
|
-
`
|
332
|
-
|
333
|
-
const MarkersContainer = styled.div`
|
334
|
-
display: flex;
|
335
|
-
flex-wrap: wrap;
|
336
|
-
gap: 8px;
|
337
|
-
margin: 4px 0 2px 36px;
|
338
|
-
align-items: end;
|
339
|
-
`
|
340
|
-
|
341
|
-
const MarkerAttrs = { backgroundColor: String }
|
342
|
-
const MarkerItem = styled('div', MarkerAttrs)`
|
343
|
-
display: flex;
|
344
|
-
gap: 5px;
|
345
|
-
align-items: center;
|
346
|
-
padding: 2px 7px;
|
347
|
-
border-radius: 4px;
|
348
|
-
background-color: ${(props) =>
|
349
|
-
props.backgroundColor
|
350
|
-
? props.theme.colors[props.backgroundColor]
|
351
|
-
: props.theme.colors.grey6};
|
352
|
-
font-size: 11px;
|
353
|
-
color: ${(props) => props.theme.colors.white};
|
354
|
-
max-width: 11ch;
|
355
|
-
white-space: nowrap;
|
356
|
-
overflow: hidden;
|
357
|
-
text-overflow: ellipsis;
|
358
|
-
& > span {
|
359
|
-
overflow: hidden;
|
360
|
-
text-overflow: ellipsis;
|
361
|
-
}
|
362
|
-
`
|
363
|
-
|
364
|
-
const ContainerValue = styled.div`
|
365
|
-
font-size: 12px;
|
366
|
-
`
|
367
|
-
|
368
|
-
const IconAttrs = {
|
369
|
-
size: { type: String, default: '36px' },
|
370
|
-
marginLeft: String,
|
371
|
-
}
|
372
|
-
const IconWrapper = styled('div', IconAttrs)`
|
373
|
-
display: flex;
|
374
|
-
align-items: center;
|
375
|
-
justify-content: center;
|
376
|
-
border-radius: 4px;
|
377
|
-
cursor: pointer;
|
378
|
-
width: ${(props) => props.size};
|
379
|
-
height: ${(props) => props.size};
|
380
|
-
margin-left: ${(props) => props.marginLeft};
|
381
|
-
&:hover {
|
382
|
-
background: ${(props) =>
|
383
|
-
props.marginLeft ? 'transparent' : 'rgba(255, 255, 255, 0.1)'};
|
384
|
-
}
|
385
|
-
|
386
|
-
&:active {
|
387
|
-
background: rgba(255, 255, 255, 0.2);
|
388
|
-
}
|
389
|
-
`
|
390
|
-
|
391
|
-
const BoxContainer = styled.div`
|
392
|
-
border-radius: 4px;
|
393
|
-
background: ${(props) => props.theme.colors.grey6};
|
394
|
-
padding: 8px;
|
395
|
-
margin-top: 8px;
|
396
|
-
margin-left: 30px;
|
397
|
-
`
|
398
|
-
|
399
|
-
const BoxTitleWrapper = styled.div`
|
400
|
-
display: flex;
|
401
|
-
align-items: center;
|
402
|
-
gap: 8px;
|
403
|
-
`
|
404
|
-
|
405
|
-
const BoxTitleText = styled.div`
|
406
|
-
font-size: 13px;
|
407
|
-
`
|
408
|
-
|
409
|
-
const BoxIconsContainer = styled.div`
|
410
|
-
display: flex;
|
411
|
-
gap: 8px;
|
412
|
-
align-items: center;
|
413
|
-
margin-left: auto;
|
414
|
-
font-size: 11px;
|
415
|
-
`
|
416
|
-
|
417
|
-
const BoxIconWrapper = styled.div`
|
418
|
-
display: flex;
|
419
|
-
align-items: center;
|
420
|
-
justify-content: center;
|
421
|
-
gap: 4px;
|
422
|
-
padding: 4px;
|
423
|
-
`
|
424
|
-
|
425
|
-
const StringBox = styled.div`
|
426
|
-
display: grid;
|
427
|
-
grid-template-columns: auto 1fr;
|
428
|
-
margin-top: 8px;
|
429
|
-
border-radius: 4px;
|
430
|
-
border: 1px solid ${(props) => props.theme.colors.grey3};
|
431
|
-
`
|
432
|
-
|
433
|
-
const StringContainer = styled.div`
|
434
|
-
display: flex;
|
435
|
-
justify-content: space-between;
|
436
|
-
gap: 8px;
|
437
|
-
padding: 8px;
|
438
|
-
font-size: 11px;
|
439
|
-
`
|
440
|
-
|
441
|
-
const StringColorAttrs = { backgroundColor: String }
|
442
|
-
const StringColorContainer = styled('div', StringColorAttrs)`
|
443
|
-
background-color: ${(props) => props.backgroundColor};
|
444
|
-
width: 22px;
|
445
|
-
min-height: 100%;
|
446
|
-
border-top-left-radius: 4px;
|
447
|
-
border-bottom-left-radius: 4px;
|
448
|
-
`
|
449
|
-
|
450
|
-
const StringIconContainer = styled.div`
|
451
|
-
display: flex;
|
452
|
-
align-items: center;
|
453
|
-
justify-content: center;
|
454
|
-
gap: 2px;
|
455
|
-
padding: 0 4px;
|
456
|
-
`
|
457
|
-
|
458
|
-
const PageTitleContainer = styled.div`
|
459
|
-
position: sticky;
|
460
|
-
top: 0;
|
461
|
-
background-color: ${(props) => props.theme.colors.black};
|
462
|
-
z-index: 99;
|
463
|
-
padding: 8px;
|
464
|
-
display: flex;
|
465
|
-
justify-content: space-between;
|
466
|
-
align-items: center;
|
467
|
-
padding-bottom: 8px;
|
468
|
-
`
|
469
|
-
|
470
|
-
const SectionTitleText = styled.div`
|
471
|
-
font-size: 14px;
|
472
|
-
font-weight: 700;
|
473
|
-
color: ${(props) => props.theme.colors.white};
|
474
|
-
`
|
475
|
-
|
476
|
-
const BatteryBoxAttrs = { isUnassigned: Boolean }
|
477
|
-
const BatteryBox = styled('div', BatteryBoxAttrs)`
|
478
|
-
display: flex;
|
479
|
-
align-items: center;
|
480
|
-
gap: 8px;
|
481
|
-
border: 1px solid ${(props) => props.theme.colors.white};
|
482
|
-
border-radius: 4px;
|
483
|
-
padding: 8px;
|
484
|
-
margin-top: 8px;
|
485
|
-
background-color: ${(props) =>
|
486
|
-
props.isUnassigned ? props.theme.colors.grey2 : ''};
|
487
|
-
`
|
488
|
-
|
489
|
-
const BatteryDetailsContainer = styled.div`
|
490
|
-
display: flex;
|
491
|
-
flex-direction: column;
|
492
|
-
gap: 4px;
|
493
|
-
`
|
494
|
-
|
495
|
-
const BatteryType = styled.div`
|
496
|
-
font-size: 11px;
|
497
|
-
`
|
498
|
-
|
499
|
-
const BatteryModel = styled.div`
|
500
|
-
font-size: 10px;
|
501
|
-
`
|
502
|
-
|
503
|
-
const BatteryValue = styled.div`
|
504
|
-
font-size: 10px;
|
505
|
-
align-self: flex-end;
|
506
|
-
margin-left: auto;
|
507
|
-
`
|
508
|
-
const TopContainer = styled.div`
|
509
|
-
display: flex;
|
510
|
-
justify-content: space-between;
|
511
|
-
`
|
512
|
-
|
513
|
-
const LeftContainer = styled.div``
|
514
|
-
|
515
|
-
const SortingContainer = styled.div`
|
516
|
-
display: flex;
|
517
|
-
flex-direction: column;
|
518
|
-
align-items: center;
|
519
|
-
`
|
520
|
-
|
521
|
-
const SortingIconWrapperAttrs = { isDisabled: Boolean }
|
522
|
-
const SortingIconWrapper = styled('div', SortingIconWrapperAttrs)`
|
523
|
-
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
524
|
-
width: 30px;
|
525
|
-
height: 30px;
|
526
|
-
display: flex;
|
527
|
-
align-items: center;
|
528
|
-
justify-content: center;
|
529
|
-
`
|
530
|
-
|
531
|
-
const UnassignedContainer = styled.div`
|
532
|
-
margin-top: 8px;
|
533
|
-
`
|
534
|
-
|
535
|
-
const DividerContainer = styled.div`
|
536
|
-
height: 0.5px;
|
537
|
-
width: 100%;
|
538
|
-
background-color: ${(props) => props.theme.colors.grey4};
|
539
|
-
opacity: 0.6;
|
540
|
-
`
|
541
|
-
|
542
|
-
const UnassignedType = styled.div`
|
543
|
-
font-size: 12px;
|
544
|
-
line-height: 150%;
|
545
|
-
`
|
546
|
-
|
547
|
-
const UnassignedModel = styled.div`
|
548
|
-
font-size: 10px;
|
549
|
-
line-height: 150%;
|
550
|
-
`
|
551
|
-
|
552
|
-
export default {
|
553
|
-
name: 'DropdownMenu',
|
554
|
-
components: {
|
555
|
-
SectionContainer,
|
556
|
-
TitleContainer,
|
557
|
-
IconsContainer,
|
558
|
-
TextContainer,
|
559
|
-
TitleText,
|
560
|
-
TitleSubText,
|
561
|
-
RCIcon,
|
562
|
-
MarkersContainer,
|
563
|
-
MarkerItem,
|
564
|
-
ContainerValue,
|
565
|
-
IconWrapper,
|
566
|
-
BoxContainer,
|
567
|
-
BoxTitleWrapper,
|
568
|
-
BoxTitleText,
|
569
|
-
BoxIconsContainer,
|
570
|
-
BoxIconWrapper,
|
571
|
-
StringBox,
|
572
|
-
StringContainer,
|
573
|
-
StringColorContainer,
|
574
|
-
StringIconContainer,
|
575
|
-
PageTitleContainer,
|
576
|
-
SectionTitleText,
|
577
|
-
ButtonIcon,
|
578
|
-
PageContainer,
|
579
|
-
BatteryBox,
|
580
|
-
BatteryDetailsContainer,
|
581
|
-
BatteryType,
|
582
|
-
BatteryModel,
|
583
|
-
BatteryValue,
|
584
|
-
TopContainer,
|
585
|
-
LeftContainer,
|
586
|
-
SortingContainer,
|
587
|
-
SortingIconWrapper,
|
588
|
-
UnassignedContainer,
|
589
|
-
DividerContainer,
|
590
|
-
UnassignedType,
|
591
|
-
UnassignedModel,
|
592
|
-
},
|
593
|
-
props: {
|
594
|
-
dataList: {
|
595
|
-
required: true,
|
596
|
-
type: Array,
|
597
|
-
},
|
598
|
-
batteryData: {
|
599
|
-
required: true,
|
600
|
-
type: Array,
|
601
|
-
},
|
602
|
-
inverterParameters: {
|
603
|
-
required: true,
|
604
|
-
type: Object,
|
605
|
-
},
|
606
|
-
},
|
607
|
-
emits: ['on-edit', 'on-move'],
|
608
|
-
data() {
|
609
|
-
return {
|
610
|
-
expandedInverters: [],
|
611
|
-
expandedMppts: [],
|
612
|
-
numberToString,
|
613
|
-
}
|
614
|
-
},
|
615
|
-
computed: {
|
616
|
-
hasExpandedSection() {
|
617
|
-
return this.expandedInverters.length > 0
|
618
|
-
},
|
619
|
-
},
|
620
|
-
watch: {
|
621
|
-
dataList: {
|
622
|
-
handler(newValue) {
|
623
|
-
console.log('newValue', newValue)
|
624
|
-
},
|
625
|
-
deep: true,
|
626
|
-
},
|
627
|
-
},
|
628
|
-
methods: {
|
629
|
-
isTargetRatioInRange(inverter) {
|
630
|
-
const currentTargetRatio = inverter.getTargetRatio()
|
631
|
-
return (
|
632
|
-
this.inverterParameters.target_power_ratio - 20 <=
|
633
|
-
100 * currentTargetRatio &&
|
634
|
-
this.inverterParameters.target_power_ratio + 20 >=
|
635
|
-
100 * currentTargetRatio
|
636
|
-
)
|
637
|
-
},
|
638
|
-
getNumberOfMpptModules(strings) {
|
639
|
-
return strings.reduce((acc, curr) => acc + curr.modules.length, 0)
|
640
|
-
},
|
641
|
-
isExpanded(id) {
|
642
|
-
return this.expandedInverters.includes(id)
|
643
|
-
},
|
644
|
-
isMpptExpanded(id) {
|
645
|
-
return this.expandedMppts.includes(id)
|
646
|
-
},
|
647
|
-
toggleSection(id) {
|
648
|
-
const index = this.expandedInverters.indexOf(id)
|
649
|
-
if (index === -1) {
|
650
|
-
this.expandedInverters.push(id)
|
651
|
-
} else {
|
652
|
-
this.expandedInverters.splice(index, 1)
|
653
|
-
}
|
654
|
-
},
|
655
|
-
toggleMppt(id) {
|
656
|
-
const index = this.expandedMppts.indexOf(id)
|
657
|
-
if (index === -1) {
|
658
|
-
this.expandedMppts.push(id)
|
659
|
-
} else {
|
660
|
-
this.expandedMppts.splice(index, 1)
|
661
|
-
}
|
662
|
-
},
|
663
|
-
toggleAllSections() {
|
664
|
-
if (this.hasExpandedSection) {
|
665
|
-
this.expandedInverters = []
|
666
|
-
this.expandedMppts = []
|
667
|
-
} else {
|
668
|
-
this.expandedInverters = this.dataList.map((item) => item.inverterId)
|
669
|
-
this.expandedMppts = this.dataList.flatMap((item) => [
|
670
|
-
...item.mppts.map((mppt) => mppt.mpptId),
|
671
|
-
...(item.storageSystem
|
672
|
-
? [item.storageSystem.storage_system_id]
|
673
|
-
: []),
|
674
|
-
])
|
675
|
-
}
|
676
|
-
},
|
677
|
-
getTypeName(type) {
|
678
|
-
const value = type.toLowerCase()
|
679
|
-
switch (value) {
|
680
|
-
case 'pv':
|
681
|
-
return this.$gettext('PV')
|
682
|
-
case 'pv_storage':
|
683
|
-
return this.$gettext('hybrid')
|
684
|
-
case 'storage':
|
685
|
-
return this.$gettext('battery')
|
686
|
-
case 'optimizer':
|
687
|
-
return this.$gettext('inverter_type_optimizer')
|
688
|
-
default:
|
689
|
-
return this.$gettext('PV')
|
690
|
-
}
|
691
|
-
},
|
692
|
-
getIconName(type) {
|
693
|
-
const value = type.toLowerCase()
|
694
|
-
switch (value) {
|
695
|
-
case 'pv':
|
696
|
-
return 'pv'
|
697
|
-
case 'pv_storage':
|
698
|
-
return 'hybrid'
|
699
|
-
case 'storage':
|
700
|
-
return 'battery'
|
701
|
-
case 'optimizer':
|
702
|
-
return 'optimizer'
|
703
|
-
default:
|
704
|
-
return 'pv'
|
705
|
-
}
|
706
|
-
},
|
707
|
-
handleMoveClick(direction, index) {
|
708
|
-
this.$emit('on-move', {
|
709
|
-
direction: direction,
|
710
|
-
index: index,
|
711
|
-
})
|
712
|
-
},
|
713
|
-
},
|
714
|
-
}
|
715
|
-
</script>
|