@eturnity/eturnity_reusable_components 7.48.1-EPDM-12680.14 → 7.48.1-EPDM-12680.16

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": "7.48.1-EPDM-12680.14",
3
+ "version": "7.48.1-EPDM-12680.16",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -0,0 +1,10 @@
1
+ <svg width="100px" height="100px" viewBox="8 8 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_888_9102)">
3
+ <path d="M9 8.5V19.75C9 20.4404 9.55964 21 10.25 21V21C10.9404 21 11.5 20.4404 11.5 19.75V10.25C11.5 9.55964 12.0596 9 12.75 9V9C13.4404 9 14 9.55964 14 10.25V21.5M15.5 9H20C20.5523 9 21 9.44772 21 10V10C21 10.5523 20.5523 11 20 11H17C16.4477 11 16 11.4477 16 12V12C16 12.5523 16.4477 13 17 13H20C20.5523 13 21 13.4477 21 14V14C21 14.5523 20.5523 15 20 15H17C16.4477 15 16 15.4477 16 16V16C16 16.5523 16.4477 17 17 17H20C20.5523 17 21 17.4477 21 18V18C21 18.5523 20.5523 19 20 19H17C16.4477 19 16 19.4477 16 20V20C16 20.5523 16.4477 21 17 21H21.5" stroke="white"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_888_9102">
7
+ <rect width="14" height="14" fill="white" transform="translate(8 8)"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>
@@ -3,6 +3,7 @@
3
3
  <PageTitleContainer>
4
4
  <SectionTitleText>{{ $gettext('inverters') }}</SectionTitleText>
5
5
  <ButtonIcon
6
+ v-if="hasStringsOrStorage"
6
7
  custom-color="black"
7
8
  :icon-name="hasExpandedSection ? 'collapse_all' : 'expand'"
8
9
  :text="$gettext(hasExpandedSection ? 'collapse_all' : 'expand_all')"
@@ -19,44 +20,52 @@
19
20
  @click="toggleSection(item.inverterId)"
20
21
  >
21
22
  <RCIcon
23
+ v-if="isItemCollapsible(item)"
22
24
  color="white"
23
25
  :name="isExpanded(item.inverterId) ? 'arrow_up' : 'arrow_down'"
24
26
  size="10px"
25
27
  />
28
+ <IconPlaceholder v-else />
26
29
  </IconWrapper>
27
30
  <TextContainer
28
31
  :style="{ marginLeft: item.type == 'optimizer' ? '36px' : '0' }"
29
32
  >
30
- <TitleText :title="item.model"
31
- >{{
33
+ <TitleText :title="item.model">
34
+ {{
32
35
  item.type === 'optimizer' && item.quantity
33
36
  ? item.quantity + ' x'
34
37
  : ''
35
38
  }}
36
- {{ item.model }}</TitleText
37
- >
38
- <TitleSubText
39
- >{{ item.brandName }} |
40
- <ContainerValue v-if="item.getkWp() > 1">
41
- {{
42
- numberToString({
43
- value: item.getkWp(),
44
- numberPrecision: 2,
45
- })
46
- }}
47
- kWp
48
- </ContainerValue>
49
- <ContainerValue v-else>
50
- {{
51
- numberToString({
52
- value: 1000 * item.getkWp(),
53
- numberPrecision: 2,
54
- minDecimals: 2,
55
- })
56
- }}
57
- Wp
58
- </ContainerValue></TitleSubText
59
- >
39
+ {{ item.model }}
40
+ </TitleText>
41
+ <TitleSubText>
42
+ <span>{{ item.brandName }}</span>
43
+ <template
44
+ v-if="itemHasStrings(item) || item.type === 'optimizer'"
45
+ >
46
+ <ContainerValue v-if="item.getkWp() > 1">
47
+ |
48
+ {{
49
+ numberToString({
50
+ value: item.getkWp(),
51
+ numberPrecision: 2,
52
+ })
53
+ }}
54
+ kWp
55
+ </ContainerValue>
56
+ <ContainerValue v-else>
57
+ |
58
+ {{
59
+ numberToString({
60
+ value: 1000 * item.getkWp(),
61
+ numberPrecision: 2,
62
+ minDecimals: 2,
63
+ })
64
+ }}
65
+ Wp
66
+ </ContainerValue>
67
+ </template>
68
+ </TitleSubText>
60
69
  </TextContainer>
61
70
  </TitleContainer>
62
71
  <MarkersContainer>
@@ -87,16 +96,14 @@
87
96
  </span>
88
97
  </MarkerItem>
89
98
  <MarkerItem>
90
- <RCIcon
91
- color="white"
92
- :name="getIconName(item.type)"
93
- size="14px"
94
- />
99
+ <RCIcon color="white" :name="getIconName(item)" size="14px" />
95
100
  <div>{{ getTypeName(item.type) }}</div>
96
101
  </MarkerItem>
97
102
  </MarkersContainer>
98
103
  <IconsContainer>
99
- <IconWrapper>
104
+ <IconWrapper
105
+ v-if="nonOptimizerInverterCount > 1 || item.type === 'optimizer'"
106
+ >
100
107
  <RCIcon
101
108
  :color="item.isLoading ? 'grey' : 'red'"
102
109
  :cursor="item.isLoading ? 'not-allowed' : 'pointer'"
@@ -106,7 +113,14 @@
106
113
  @click="!item.isLoading && $emit('on-delete', item)"
107
114
  />
108
115
  </IconWrapper>
109
- <IconWrapper @click="!item.isLoading && $emit('on-edit', item)">
116
+ <IconWrapper
117
+ @click="
118
+ !(
119
+ item.isLoading ||
120
+ (item.type != 'pv_storage' && !item.hasTemplate)
121
+ ) && $emit('on-edit', item)
122
+ "
123
+ >
110
124
  <RCIcon
111
125
  :color="
112
126
  item.isLoading ||
@@ -238,6 +252,54 @@
238
252
  </StringBox>
239
253
  </div>
240
254
  </BoxContainer>
255
+ <template v-if="availableMPPTData(item)">
256
+ <BoxContainer
257
+ v-for="availableItem in availableMPPTData(item)"
258
+ v-show="isExpanded(item.inverterId)"
259
+ :key="availableItem.mpptId"
260
+ >
261
+ <BoxTitleWrapper>
262
+ <IconWrapper
263
+ margin-left="4px"
264
+ size="8px"
265
+ @click="toggleMppt(availableItem.mpptId)"
266
+ >
267
+ <RCIcon
268
+ color="white"
269
+ cursor="pointer"
270
+ :name="
271
+ isMpptExpanded(availableItem.mpptId)
272
+ ? 'arrow_up'
273
+ : 'arrow_down'
274
+ "
275
+ size="10px"
276
+ />
277
+ </IconWrapper>
278
+ <BoxTitleText>{{ availableItem.name }}</BoxTitleText>
279
+ <BoxIconsContainer>
280
+ <BoxIconWrapper>
281
+ <RCIcon
282
+ color="white"
283
+ cursor="pointer"
284
+ name="string_design"
285
+ size="11px"
286
+ />
287
+ <div>0/{{ availableItem.numberOfTerminals }}</div>
288
+ </BoxIconWrapper>
289
+ <BoxIconWrapper>
290
+ <RCIcon
291
+ color="white"
292
+ cursor="pointer"
293
+ name="panels_tool"
294
+ size="11px"
295
+ />
296
+ <div>{{ getTotalModules(item) }}</div>
297
+ </BoxIconWrapper>
298
+ </BoxIconsContainer>
299
+ </BoxTitleWrapper>
300
+ <EmptyStringBox v-show="isMpptExpanded(availableItem.mpptId)" />
301
+ </BoxContainer>
302
+ </template>
241
303
  <BoxContainer
242
304
  v-if="item.storageSystem && Object.keys(item.storageSystem).length > 0"
243
305
  v-show="isExpanded(item.inverterId)"
@@ -579,6 +641,19 @@
579
641
  line-height: 150%;
580
642
  `
581
643
 
644
+ const IconPlaceholder = styled.div`
645
+ width: 36px;
646
+ `
647
+
648
+ const EmptyStringBox = styled.div`
649
+ border: 0.8px dashed ${(props) => props.theme.colors.black};
650
+ border-radius: 4px;
651
+ padding: 8px 8px 8px 0;
652
+ height: 32px;
653
+ width: 233px;
654
+ margin-top: 8px;
655
+ `
656
+
582
657
  export default {
583
658
  name: 'DropdownMenu',
584
659
  components: {
@@ -619,6 +694,8 @@
619
694
  DividerContainer,
620
695
  UnassignedType,
621
696
  UnassignedModel,
697
+ IconPlaceholder,
698
+ EmptyStringBox,
622
699
  },
623
700
  props: {
624
701
  dataList: {
@@ -646,15 +723,34 @@
646
723
  hasExpandedSection() {
647
724
  return this.expandedInverters.length > 0
648
725
  },
649
- },
650
- watch: {
651
- dataList: {
652
- handler(newValue) {
653
- console.log('newValue', newValue)
654
- },
655
- deep: true,
726
+ hasStringsOrStorage() {
727
+ return this.dataList.some((item) => {
728
+ return (
729
+ item.mppts.some((mppt) => mppt.strings.length > 0) ||
730
+ (item.storageSystem && Object.keys(item.storageSystem).length > 0)
731
+ )
732
+ })
733
+ },
734
+ nonOptimizerInverterCount() {
735
+ return this.dataList.filter((item) => item.type !== 'optimizer').length
656
736
  },
657
737
  },
738
+ created() {
739
+ // Expand all items on creation
740
+ if (this.hasStringsOrStorage) {
741
+ this.expandedInverters = this.dataList.map((item) => item.inverterId)
742
+ this.expandedMppts = this.dataList.flatMap((item) => {
743
+ const availableMppts = this.availableMPPTData(item)
744
+ return [
745
+ ...item.mppts.map((mppt) => mppt.mpptId),
746
+ ...(item.storageSystem
747
+ ? [item.storageSystem.storage_system_id]
748
+ : []),
749
+ ...(availableMppts?.map((mppt) => mppt.mpptId) || []),
750
+ ]
751
+ })
752
+ }
753
+ },
658
754
  methods: {
659
755
  isTargetRatioInRange(inverter) {
660
756
  const currentTargetRatio = inverter.getTargetRatio()
@@ -668,6 +764,44 @@
668
764
  getNumberOfMpptModules(strings) {
669
765
  return strings.reduce((acc, curr) => acc + curr.modules.length, 0)
670
766
  },
767
+ getTotalModules(item) {
768
+ // This is for the available MPPTs
769
+ return item.mppts.reduce((total, mppt) => {
770
+ return (
771
+ total +
772
+ mppt.strings.reduce((stringTotal, string) => {
773
+ return stringTotal + string.modules.length
774
+ }, 0)
775
+ )
776
+ }, 0)
777
+ },
778
+ availableMPPTData(item) {
779
+ if (item.type === 'optimizer' || item.type === 'storage') {
780
+ return []
781
+ }
782
+ const existingTrackerNumbers = item.mppts.map(
783
+ (mppt) => mppt.tracker_number
784
+ )
785
+ const filteredAvailableMPPTs = item.availableMPPTs.filter(
786
+ (mppt) => !existingTrackerNumbers.includes(mppt.tracker_number)
787
+ )
788
+
789
+ let mpptData = []
790
+ filteredAvailableMPPTs.forEach((mppt) => {
791
+ mpptData.push({
792
+ mpptId:
793
+ 'available_mppt_' +
794
+ item.companyComponentLibraryId +
795
+ '_' +
796
+ mppt.tracker_number,
797
+ numberOfTerminals: mppt.number_of_terminals,
798
+ name:
799
+ 'MPPT ' +
800
+ (item.mppts.length + filteredAvailableMPPTs.indexOf(mppt) + 1),
801
+ })
802
+ })
803
+ return mpptData
804
+ },
671
805
  isExpanded(id) {
672
806
  return this.expandedInverters.includes(id)
673
807
  },
@@ -696,14 +830,30 @@
696
830
  this.expandedMppts = []
697
831
  } else {
698
832
  this.expandedInverters = this.dataList.map((item) => item.inverterId)
699
- this.expandedMppts = this.dataList.flatMap((item) => [
700
- ...item.mppts.map((mppt) => mppt.mpptId),
701
- ...(item.storageSystem
702
- ? [item.storageSystem.storage_system_id]
703
- : []),
704
- ])
833
+ this.expandedMppts = this.dataList.flatMap((item) => {
834
+ const availableMppts = this.availableMPPTData(item)
835
+ return [
836
+ ...item.mppts.map((mppt) => mppt.mpptId),
837
+ ...(item.storageSystem
838
+ ? [item.storageSystem.storage_system_id]
839
+ : []),
840
+ ...(availableMppts
841
+ ? availableMppts.map((mppt) => mppt.mpptId)
842
+ : []),
843
+ ]
844
+ })
705
845
  }
706
846
  },
847
+ isItemCollapsible(item) {
848
+ return (
849
+ item.mppts.some((mppt) => mppt.strings.length > 0) ||
850
+ (item.storageSystem && Object.keys(item.storageSystem).length > 0) ||
851
+ item.availableMPPTs.length
852
+ )
853
+ },
854
+ itemHasStrings(item) {
855
+ return item.mppts.some((mppt) => mppt.strings.length > 0)
856
+ },
707
857
  getTypeName(type) {
708
858
  const value = type.toLowerCase()
709
859
  switch (value) {
@@ -719,15 +869,20 @@
719
869
  return this.$gettext('PV')
720
870
  }
721
871
  },
722
- getIconName(type) {
723
- const value = type.toLowerCase()
872
+ getIconName(item) {
873
+ const value =
874
+ item.type === 'pv_storage'
875
+ ? item.iconName.technology_choice
876
+ : item.type
724
877
  switch (value) {
878
+ case 'photovoltaics':
879
+ return 'pv'
725
880
  case 'pv':
726
881
  return 'pv'
727
- case 'pv_storage':
728
- return 'hybrid'
729
882
  case 'storage':
730
883
  return 'battery'
884
+ case 'battery':
885
+ return 'battery'
731
886
  case 'optimizer':
732
887
  return 'optimizer'
733
888
  default: