openatc-components 0.5.50 → 0.5.51

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.
@@ -678,14 +678,14 @@ export default {
678
678
  obj.id = ring.phases
679
679
  // if (ring.sum) {
680
680
  // obj.sum = ring.sum
681
- // obj.redWidth = ((currPhase.redclear + ring.sum) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
681
+ // obj.redWidth = (((currPhase.redclear || 0) + ring.sum) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
682
682
  // } else {
683
- // obj.redWidth = (currPhase.redclear / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
683
+ // obj.redWidth = ((currPhase.redclear || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
684
684
  // }
685
685
  // obj.mode = ring.mode
686
686
  obj.greenWidth = (split / (cycle > this.cycles ? cycle : this.cycles)) * 100 + '%'
687
- // obj.flashgreen = (currPhase.flashgreen / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
688
- // obj.yellowWidth = (currPhase.yellow / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
687
+ // obj.flashgreen = ((currPhase.flashgreen || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
688
+ // obj.yellowWidth = ((currPhase.yellow || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
689
689
  // 忽略相位不显示
690
690
  // let mode = ring.mode
691
691
  // if (mode !== 7) { // 忽略相位不显示
@@ -1148,13 +1148,13 @@ export default {
1148
1148
  obj.cycle = cycle
1149
1149
  if (ring.sum) {
1150
1150
  obj.sum = ring.sum
1151
- obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : cycle) * 100) + '%'
1151
+ obj.redWidth = (((currPhase.redclear || 0) + ring.sum) / (this.max ? this.max : cycle) * 100) + '%'
1152
1152
  } else {
1153
- obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100) + '%'
1153
+ obj.redWidth = ((currPhase.redclear || 0) / (this.max ? this.max : cycle) * 100) + '%'
1154
1154
  }
1155
- obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100) + '%'
1156
- obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100) + '%'
1157
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100) + '%'
1155
+ obj.flashgreen = (((currPhase.flashgreen || 0) || 0) / (this.max ? this.max : cycle) * 100) + '%'
1156
+ obj.yellowWidth = ((currPhase.yellow || 0) / (this.max ? this.max : cycle) * 100) + '%'
1157
+ obj.greenWidth = ((split - (currPhase.redclear || 0) - (currPhase.yellow || 0) - (currPhase.flashgreen || 0)) / (this.max ? this.max : cycle) * 100) + '%'
1158
1158
  // 忽略相位不显示
1159
1159
  // let mode = ring.mode
1160
1160
  // if (mode !== 7) { // 忽略相位不显示
@@ -1452,13 +1452,13 @@ export default {
1452
1452
  obj.cycle = cycle
1453
1453
  if (ring.sum) {
1454
1454
  obj.sum = ring.sum
1455
- obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : cycle) * 100) + '%'
1455
+ obj.redWidth = (((currPhase.redclear || 0) + ring.sum) / (this.max ? this.max : cycle) * 100) + '%'
1456
1456
  } else {
1457
- obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100) + '%'
1457
+ obj.redWidth = ((currPhase.redclear || 0) / (this.max ? this.max : cycle) * 100) + '%'
1458
1458
  }
1459
- obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100) + '%'
1460
- obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100) + '%'
1461
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100) + '%'
1459
+ obj.flashgreen = ((currPhase.flashgreen || 0) / (this.max ? this.max : cycle) * 100) + '%'
1460
+ obj.yellowWidth = ((currPhase.yellow || 0) / (this.max ? this.max : cycle) * 100) + '%'
1461
+ obj.greenWidth = ((split - (currPhase.redclear || 0) - (currPhase.yellow || 0) - (currPhase.flashgreen || 0)) / (this.max ? this.max : cycle) * 100) + '%'
1462
1462
  // 忽略相位不显示
1463
1463
  // let mode = ring.mode
1464
1464
  // if (mode !== 7) { // 忽略相位不显示
@@ -1742,29 +1742,29 @@ export default {
1742
1742
  }
1743
1743
  obj.split = split
1744
1744
  obj.cycle = this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle
1745
- const isZero = split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen
1746
- const allAdd = split + currPhase.redclear + currPhase.yellow + currPhase.flashgreen
1745
+ const isZero = split - (currPhase.redclear || 0) - (currPhase.yellow || 0) - (currPhase.flashgreen || 0)
1746
+ const allAdd = split + (currPhase.redclear || 0) + (currPhase.yellow || 0) + (currPhase.flashgreen || 0)
1747
1747
  if (isZero <= 0) {
1748
1748
  if (ring.sum) {
1749
1749
  obj.sum = ring.sum
1750
- obj.redWidth = ((((currPhase.redclear + ring.sum) / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1750
+ obj.redWidth = (((((currPhase.redclear || 0) + ring.sum) / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1751
1751
  } else {
1752
- obj.redWidth = (((currPhase.redclear / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1752
+ obj.redWidth = ((((currPhase.redclear || 0) / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1753
1753
  }
1754
- obj.greenWidth = (((split - (currPhase.redclear / allAdd) - (currPhase.yellow / allAdd) - (currPhase.flashgreen / allAdd)) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1755
- obj.yellowWidth = (((currPhase.yellow / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1756
- obj.flashgreen = (((currPhase.flashgreen / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1754
+ obj.greenWidth = (((split - ((currPhase.redclear || 0) / allAdd) - ((currPhase.yellow || 0) / allAdd) - ((currPhase.flashgreen || 0) / allAdd)) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1755
+ obj.yellowWidth = ((((currPhase.yellow || 0) / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1756
+ obj.flashgreen = ((((currPhase.flashgreen || 0) / allAdd) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle)) * 100) + '%'
1757
1757
  } else {
1758
1758
  if (ring.sum) {
1759
1759
  obj.sum = ring.sum
1760
- obj.redWidth = ((currPhase.redclear + ring.sum) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1760
+ obj.redWidth = (((currPhase.redclear || 0) + ring.sum) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1761
1761
  } else {
1762
- obj.redWidth = (currPhase.redclear / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1762
+ obj.redWidth = ((currPhase.redclear || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1763
1763
  }
1764
1764
  obj.mode = ring.mode
1765
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1766
- obj.flashgreen = (currPhase.flashgreen / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1767
- obj.yellowWidth = (currPhase.yellow / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1765
+ obj.greenWidth = ((split - (currPhase.redclear || 0) - (currPhase.yellow || 0) - (currPhase.flashgreen || 0)) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1766
+ obj.flashgreen = ((currPhase.flashgreen || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1767
+ obj.yellowWidth = ((currPhase.yellow || 0) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
1768
1768
  }
1769
1769
  // 忽略相位不显示
1770
1770
  // let mode = ring.mode