@eturnity/eturnity_reusable_components 7.4.4-EPDM-7260.11 → 7.4.4-EPDM-7260.13

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.4.4-EPDM-7260.11",
3
+ "version": "7.4.4-EPDM-7260.13",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -22,7 +22,9 @@
22
22
  :draggable="!disabled"
23
23
  :resizable="!disabled"
24
24
  :color="
25
- hasOverlap && OverlapId === label.id ? '#ff5656' : bar.color
25
+ hasOverlap && OverlapId.includes(label.id)
26
+ ? '#ff5656'
27
+ : bar.color
26
28
  "
27
29
  :minWidth="minWidth"
28
30
  :min="bar.min"
@@ -57,13 +59,7 @@
57
59
  )
58
60
  "
59
61
  @click.native.stop="
60
- if (disabled) return
61
-
62
- $emit('on-bar-tariff-click', {
63
- type: 'delete',
64
- item: bar,
65
- label: label
66
- })
62
+ onBarTariffClick({ item: bar, type: 'delete', label })
67
63
  "
68
64
  @activated="onActivateBar({ item: bar })"
69
65
  @deactivated="onDeactivateBar()"
@@ -84,7 +80,7 @@
84
80
  <RulerSubRule v-for="n in subStepCount" :key="n"></RulerSubRule>
85
81
  </SubRuler>
86
82
  <ErrorMessage
87
- v-if="!canOverlap && hasOverlap && OverlapId === label.id"
83
+ v-if="!canOverlap && hasOverlap && OverlapId.includes(label.id)"
88
84
  >
89
85
  *{{ $gettext('overlap_error_message') }}
90
86
  </ErrorMessage>
@@ -100,7 +96,9 @@
100
96
  <bar-item-container
101
97
  v-for="item in barOptionsList"
102
98
  :key="item.id"
103
- @click="onBarTariffClick({ item })"
99
+ @click="
100
+ onBarTariffClick({ item, type: barOptionsType, label: activeLabel })
101
+ "
104
102
  >
105
103
  <icon
106
104
  :name="barOptionsType === 'add' ? 'add_icon' : 'delete'"
@@ -319,7 +317,7 @@ export default {
319
317
  barOptionsType: null, // can be "add" or "delete"
320
318
  activeLabel: null,
321
319
  activeItem: null,
322
- OverlapId: null,
320
+ OverlapId: [],
323
321
  hasOverlap: false
324
322
  }
325
323
  },
@@ -369,7 +367,15 @@ export default {
369
367
  this.$emit(type, value)
370
368
 
371
369
  this.hasOverlap = this.checkOverlap(value, tariffs)
372
- this.OverlapId = this.hasOverlap ? entityId : null
370
+
371
+ if (this.hasOverlap) {
372
+ const existing = this.OverlapId.find((id) => id === entityId)
373
+
374
+ if (!existing) this.OverlapId.push(entityId)
375
+ } else
376
+ this.OverlapId = this.OverlapId
377
+ ? this.OverlapId.filter((id) => id !== entityId)
378
+ : []
373
379
 
374
380
  this.$emit('has-overlap', this.hasOverlap)
375
381
  },
@@ -379,7 +385,7 @@ export default {
379
385
  const max = parseFloat(value.max)
380
386
 
381
387
  return tariffs.some((tariff) => {
382
- if (tariff.id === value.itemId) return false
388
+ if (tariff.id === value.itemId || tariff.id === value.id) return false
383
389
 
384
390
  return (
385
391
  min === tariff.min ||
@@ -419,15 +425,17 @@ export default {
419
425
  this.activeItem = null
420
426
  }
421
427
  },
422
- onBarTariffClick({ item }) {
428
+ onBarTariffClick({ item, type, label }) {
423
429
  if (this.disabled) return
424
430
 
425
431
  this.$emit('on-bar-tariff-click', {
426
- type: this.barOptionsType,
432
+ type,
427
433
  item,
428
- label: this.activeLabel
434
+ label
429
435
  })
430
436
 
437
+ this.activeLabel = label
438
+ this.barOptionsType = type
431
439
  this.hasOverlap = this.checkOverlap(
432
440
  item,
433
441
  this.activeLabel.selectedTariffs
@@ -489,14 +497,29 @@ export default {
489
497
  document.removeEventListener('keydown', this.onKeyDownDelete)
490
498
  },
491
499
  watch: {
492
- tariffItems(item, oldData) {
493
- if (item.length !== oldData.length) {
494
- this.hasOverlap = this.checkOverlap(
495
- {
496
- itemId: 0
497
- },
498
- item
499
- )
500
+ labels(newVal, oldVal) {
501
+ //check items for overlap
502
+ if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
503
+ const labels = newVal.find((label) => label.placement === 'left')
504
+
505
+ if (labels) {
506
+ labels.value.forEach((label) => {
507
+ label.selectedTariffs.forEach((tariff) => {
508
+ this.hasOverlap = this.checkOverlap(tariff, label.selectedTariffs)
509
+
510
+ if (this.hasOverlap) {
511
+ const existing = this.OverlapId.find((id) => id === label.id)
512
+
513
+ if (!existing) this.OverlapId.push(label.id)
514
+ } else
515
+ this.OverlapId = this.OverlapId
516
+ ? this.OverlapId.filter((id) => id !== label.id)
517
+ : []
518
+ })
519
+ })
520
+ }
521
+
522
+ this.$emit('has-overlap', this.hasOverlap)
500
523
  }
501
524
  }
502
525
  }