openatc-components 0.5.44 → 0.5.45

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.
@@ -623,18 +623,22 @@ export default {
623
623
  return item.id === stg
624
624
  })[0]
625
625
  if (!currPhase) return
626
- if (!currPhase.peddirection) return
626
+ // if (!currPhase.peddirection) return
627
627
  for (let walk of this.sidewalkPhaseData) {
628
- for (let ped of currPhase.peddirection) {
629
- if (stg === walk.phaseid) {
630
- let obj = {}
631
- obj.name = walk.name
632
- obj.id = walk.id
633
- if (ped === walk.id) {
634
- peddirections.push(obj)
635
- peddirections = Array.from(new Set(peddirections))
628
+ if (currPhase.peddirection) {
629
+ for (let ped of currPhase.peddirection) {
630
+ if (stg === walk.phaseid) {
631
+ let obj = {}
632
+ obj.name = walk.name
633
+ obj.id = walk.id
634
+ if (ped === walk.id) {
635
+ peddirections.push(obj)
636
+ peddirections = Array.from(new Set(peddirections))
637
+ }
636
638
  }
637
639
  }
640
+ } else {
641
+ peddirections = []
638
642
  }
639
643
  }
640
644
  ped.push(...peddirections)
@@ -179,7 +179,7 @@ export default {
179
179
  let phasedesc = this.phaseOption.filter((item) => {
180
180
  return item.id === id
181
181
  })[0].direction
182
- if (phasedesc.length === 0) return id
182
+ if (!phasedesc || phasedesc.length === 0) return id
183
183
  let description = getPhaseDesc(phasedesc, this.$i18n)
184
184
  return id + '-' + description
185
185
  },
@@ -188,22 +188,31 @@ export default {
188
188
  this.dirArr = []
189
189
  this.phaseOption.filter((item) => {
190
190
  if (item.id === data) {
191
- if (item.direction.length === 0) {
192
- let recd = {
193
- id: 0,
194
- peddirection: this.getPed(item.peddirection),
195
- color: color
196
- }
197
- this.dirArr.push(recd)
198
- } else {
199
- for (let rec of item.direction) {
191
+ if (item.direction) {
192
+ if (item.direction.length === 0) {
200
193
  let recd = {
201
- id: rec,
194
+ id: 0,
202
195
  peddirection: this.getPed(item.peddirection),
203
196
  color: color
204
197
  }
205
198
  this.dirArr.push(recd)
199
+ } else {
200
+ for (let rec of item.direction) {
201
+ let recd = {
202
+ id: rec,
203
+ peddirection: this.getPed(item.peddirection),
204
+ color: color
205
+ }
206
+ this.dirArr.push(recd)
207
+ }
206
208
  }
209
+ } else {
210
+ let recd = {
211
+ id: 0,
212
+ peddirection: this.getPed(item.peddirection),
213
+ color: color
214
+ }
215
+ this.dirArr.push(recd)
207
216
  }
208
217
  }
209
218
  })
@@ -239,22 +248,31 @@ export default {
239
248
  let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'
240
249
  this.Options = list.map((item, index) => {
241
250
  let dirArr = []
242
- if (item.direction.length === 0) {
243
- let recd = {
244
- id: 0,
245
- peddirection: this.getPed(item.peddirection),
246
- color: color
247
- }
248
- dirArr.push(recd)
249
- } else {
250
- for (let rec of item.direction) {
251
+ if (item.direction) {
252
+ if (item.direction.length === 0) {
251
253
  let recd = {
252
- id: rec,
254
+ id: 0,
253
255
  peddirection: this.getPed(item.peddirection),
254
256
  color: color
255
257
  }
256
258
  dirArr.push(recd)
259
+ } else {
260
+ for (let rec of item.direction) {
261
+ let recd = {
262
+ id: rec,
263
+ peddirection: this.getPed(item.peddirection),
264
+ color: color
265
+ }
266
+ dirArr.push(recd)
267
+ }
268
+ }
269
+ } else {
270
+ let recd = {
271
+ id: 0,
272
+ peddirection: this.getPed(item.peddirection),
273
+ color: color
257
274
  }
275
+ dirArr.push(recd)
258
276
  }
259
277
  let name = ''
260
278
  name = this.$t('openatccomponents.pattern.phase') + item.id
@@ -313,6 +331,7 @@ export default {
313
331
  })
314
332
  },
315
333
  getPed (data) {
334
+ if (!data) return
316
335
  let ped = []
317
336
  let peddirections = []
318
337
  let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'