@eturnity/eturnity_reusable_components 7.4.4-EPDM-7260.8 → 7.4.4-EPDM-7260.9

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.8",
3
+ "version": "7.4.4-EPDM-7260.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -8,7 +8,10 @@
8
8
  :noWrap="noWrap"
9
9
  :data-id="dataId"
10
10
  >
11
- {{ text }}
11
+ <Label :hasIcon="Boolean(icon)">
12
+ <icon v-if="icon" :name="icon" size="14px" />
13
+ {{ text }}
14
+ </Label>
12
15
  </button-container>
13
16
  </page-container>
14
17
  </template>
@@ -20,12 +23,14 @@
20
23
  // text="Click Me"
21
24
  // customColor="#ab5348"
22
25
  // type="secondary" // primary, secondary, cancel
26
+ // icon="icon-name" // icon name from icon component
23
27
  // :isDisabled="true"
24
28
  // :minWidth="minWidth"
25
29
  // :data-id="test_data_id"
26
30
  // />
27
31
 
28
32
  import styled from 'vue-styled-components'
33
+ import Icon from '../../icon'
29
34
 
30
35
  const PageContainer = styled.div``
31
36
 
@@ -68,9 +73,22 @@ const ButtonContainer = styled('div', ButtonAttrs)`
68
73
  }
69
74
  `
70
75
 
76
+ const LabelAttrs = {
77
+ hasIcon: Boolean
78
+ }
79
+
80
+ const Label = styled('span', LabelAttrs)`
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: center;
84
+ gap: ${(props) => (props.hasIcon ? '5px' : '0')};
85
+ `
86
+
71
87
  export default {
72
88
  name: 'main-button',
73
89
  components: {
90
+ Icon,
91
+ Label,
74
92
  PageContainer,
75
93
  ButtonContainer
76
94
  },
@@ -83,6 +101,10 @@ export default {
83
101
  required: false,
84
102
  default: false
85
103
  },
104
+ icon: {
105
+ required: false,
106
+ default: null
107
+ },
86
108
  text: {
87
109
  required: true
88
110
  },
@@ -9,7 +9,12 @@
9
9
  require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
10
10
  "
11
11
  ></icon-image>
12
- <striked-line v-if="isStriked" :color="color" :disabled="disabled" :hoveredColor="hoveredColor"></striked-line>
12
+ <striked-line
13
+ v-if="isStriked"
14
+ :color="color"
15
+ :disabled="disabled"
16
+ :hoveredColor="hoveredColor"
17
+ ></striked-line>
13
18
  </Wrapper>
14
19
  </template>
15
20
 
@@ -40,17 +45,22 @@ const Wrapper = styled('div', wrapperAttrs)`
40
45
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : props.cursor)};
41
46
  line-height: 0;
42
47
  `
43
- const strikedAttrs = { isDisabled: Boolean, color: String, hoveredColor: String }
48
+ const strikedAttrs = {
49
+ isDisabled: Boolean,
50
+ color: String,
51
+ hoveredColor: String
52
+ }
44
53
  const strikedLine = styled('div', strikedAttrs)`
45
54
  display: flex;
46
55
  position: absolute;
47
- bottom:0;
48
- left:0;
56
+ bottom: 0;
57
+ left: 0;
49
58
  align-content: center;
50
59
  justify-content: center;
51
60
  width: 143%;
52
- height:8%;
53
- background-color: ${(props)=>props.theme.colors[props.color] || props.color};
61
+ height: 8%;
62
+ background-color: ${(props) =>
63
+ props.theme.colors[props.color] || props.color};
54
64
  min-height: 0;
55
65
  line-height: 0;
56
66
  transform-origin: 0% 100%;
@@ -71,7 +81,7 @@ const IconImage = styled('div', IconImageProps)`
71
81
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
72
82
  }
73
83
  &:hover + div {
74
- background-color: ${(props)=>props.hoveredColor};
84
+ background-color: ${(props) => props.hoveredColor};
75
85
  }
76
86
  `
77
87
 
@@ -11,7 +11,7 @@
11
11
  <VerticalLabel>{{ label.name }}</VerticalLabel>
12
12
  <BarSlider>
13
13
  <Bar
14
- @contextmenu="
14
+ @click.native.stop="
15
15
  onBarRightClick({ event: $event, label, type: 'add' })
16
16
  "
17
17
  >
@@ -57,12 +57,11 @@
57
57
  label.selectedTariffs
58
58
  )
59
59
  "
60
- @contextmenu.native.stop="
61
- onBarRightClick({
62
- event: $event,
63
- label,
60
+ @click.native.stop="
61
+ $emit('on-bar-tariff-click', {
64
62
  type: 'delete',
65
- bar
63
+ item: bar,
64
+ label: activeLabel
66
65
  })
67
66
  "
68
67
  @activated="onActivateBar({ item: bar })"
@@ -401,6 +400,7 @@ export default {
401
400
  document.addEventListener('keydown', this.onKeyDownDelete)
402
401
  },
403
402
  onDeactivateBar() {
403
+ this.$emit('deactivate')
404
404
  this.activeItem = null
405
405
  document.removeEventListener('keydown', this.onKeyDownDelete)
406
406
  },