@eturnity/eturnity_reusable_components 7.4.4-EPDM-7260.10 → 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.10",
3
+ "version": "7.4.4-EPDM-7260.13",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -19,11 +19,12 @@
19
19
  <Slider
20
20
  v-for="(bar, index) in label.selectedTariffs"
21
21
  :key="bar.id"
22
- :active="!disabled"
23
22
  :draggable="!disabled"
24
23
  :resizable="!disabled"
25
24
  :color="
26
- hasOverlap && OverlapId === label.id ? '#ff5656' : bar.color
25
+ hasOverlap && OverlapId.includes(label.id)
26
+ ? '#ff5656'
27
+ : bar.color
27
28
  "
28
29
  :minWidth="minWidth"
29
30
  :min="bar.min"
@@ -58,11 +59,7 @@
58
59
  )
59
60
  "
60
61
  @click.native.stop="
61
- $emit('on-bar-tariff-click', {
62
- type: 'delete',
63
- item: bar,
64
- label: activeLabel
65
- })
62
+ onBarTariffClick({ item: bar, type: 'delete', label })
66
63
  "
67
64
  @activated="onActivateBar({ item: bar })"
68
65
  @deactivated="onDeactivateBar()"
@@ -83,7 +80,7 @@
83
80
  <RulerSubRule v-for="n in subStepCount" :key="n"></RulerSubRule>
84
81
  </SubRuler>
85
82
  <ErrorMessage
86
- v-if="!canOverlap && hasOverlap && OverlapId === label.id"
83
+ v-if="!canOverlap && hasOverlap && OverlapId.includes(label.id)"
87
84
  >
88
85
  *{{ $gettext('overlap_error_message') }}
89
86
  </ErrorMessage>
@@ -99,7 +96,9 @@
99
96
  <bar-item-container
100
97
  v-for="item in barOptionsList"
101
98
  :key="item.id"
102
- @click="onBarTariffClick({ item })"
99
+ @click="
100
+ onBarTariffClick({ item, type: barOptionsType, label: activeLabel })
101
+ "
103
102
  >
104
103
  <icon
105
104
  :name="barOptionsType === 'add' ? 'add_icon' : 'delete'"
@@ -318,7 +317,7 @@ export default {
318
317
  barOptionsType: null, // can be "add" or "delete"
319
318
  activeLabel: null,
320
319
  activeItem: null,
321
- OverlapId: null,
320
+ OverlapId: [],
322
321
  hasOverlap: false
323
322
  }
324
323
  },
@@ -368,7 +367,15 @@ export default {
368
367
  this.$emit(type, value)
369
368
 
370
369
  this.hasOverlap = this.checkOverlap(value, tariffs)
371
- 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
+ : []
372
379
 
373
380
  this.$emit('has-overlap', this.hasOverlap)
374
381
  },
@@ -378,7 +385,7 @@ export default {
378
385
  const max = parseFloat(value.max)
379
386
 
380
387
  return tariffs.some((tariff) => {
381
- if (tariff.id === value.itemId) return false
388
+ if (tariff.id === value.itemId || tariff.id === value.id) return false
382
389
 
383
390
  return (
384
391
  min === tariff.min ||
@@ -418,13 +425,17 @@ export default {
418
425
  this.activeItem = null
419
426
  }
420
427
  },
421
- onBarTariffClick({ item }) {
428
+ onBarTariffClick({ item, type, label }) {
429
+ if (this.disabled) return
430
+
422
431
  this.$emit('on-bar-tariff-click', {
423
- type: this.barOptionsType,
432
+ type,
424
433
  item,
425
- label: this.activeLabel
434
+ label
426
435
  })
427
436
 
437
+ this.activeLabel = label
438
+ this.barOptionsType = type
428
439
  this.hasOverlap = this.checkOverlap(
429
440
  item,
430
441
  this.activeLabel.selectedTariffs
@@ -449,6 +460,8 @@ export default {
449
460
  }
450
461
  },
451
462
  onBarRightClick({ event, label, type, bar }) {
463
+ if (this.disabled) return
464
+
452
465
  // type can be "add", "delete"
453
466
  // if "add", show all tariffItems for the group
454
467
  // if "delete", only show the delete with the tariff name
@@ -484,14 +497,29 @@ export default {
484
497
  document.removeEventListener('keydown', this.onKeyDownDelete)
485
498
  },
486
499
  watch: {
487
- tariffItems(item, oldData) {
488
- if (item.length !== oldData.length) {
489
- this.hasOverlap = this.checkOverlap(
490
- {
491
- itemId: 0
492
- },
493
- item
494
- )
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)
495
523
  }
496
524
  }
497
525
  }