@eturnity/eturnity_reusable_components 7.4.4-EPDM-9606 → 7.4.4-EPDM-7260.3

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.
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <page-container @click="toggleButton()" ref="pageContainer" :activated="isOpen">
2
+ <page-container
3
+ @click="toggleButton()"
4
+ ref="pageContainer"
5
+ :activated="isOpen"
6
+ >
3
7
  <button-container ref="dropdownItem">
4
8
  <dot-item />
5
9
  <dot-item />
@@ -23,40 +27,44 @@
23
27
  v-for="child in childOpen"
24
28
  :key="child.value"
25
29
  @click.stop="
26
- onSelect({
27
- item: child,
28
- hasChildren: hasChildren(child)
29
- })
30
- "
30
+ onSelect({
31
+ item: child,
32
+ hasChildren: hasChildren(child)
33
+ })
34
+ "
31
35
  @keyup.enter.stop="
32
- onSelect({
33
- item: child,
34
- hasChildren: hasChildren(child)
35
- })
36
- "
36
+ onSelect({
37
+ item: child,
38
+ hasChildren: hasChildren(child)
39
+ })
40
+ "
37
41
  >
38
42
  {{ child.name }}
39
43
  </option-child>
40
44
  </children-container>
41
- <options-container v-if="!isLoading">
45
+ <options-container v-if="!isLoading" :textWrap="textWrap">
42
46
  <option-item
43
47
  v-for="(item, index) in options"
44
48
  :key="item.value"
49
+ :data-id="item.dataId"
45
50
  tabindex="0"
46
- @click.stop="onSelect({ item: item, hasChildren: hasChildren(item) })"
51
+ @click.stop="
52
+ onSelect({ item: item, hasChildren: hasChildren(item) })
53
+ "
47
54
  @keyup.enter="
48
- onSelect({ item: item, hasChildren: hasChildren(item) })
49
- "
55
+ onSelect({ item: item, hasChildren: hasChildren(item) })
56
+ "
50
57
  @mouseover="onItemHover({ index, item })"
51
58
  :isDisabled="item.disabled"
59
+ :title="item.title"
52
60
  >
53
61
  <arrow-left
54
62
  :hasChildren="hasChildren(item)"
55
63
  v-if="hasChildren(item)"
56
64
  />
57
65
  <span>
58
- {{ item.name }}
59
- </span>
66
+ {{ item.name }}
67
+ </span>
60
68
  </option-item>
61
69
  </options-container>
62
70
  </template>
@@ -68,9 +76,10 @@
68
76
  // import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/threeDots"
69
77
  // To use:
70
78
  // <three-dots
79
+ // :isLoading="true"
71
80
  // :options="listOptions"
81
+ // @on-click="onClick($event)"
72
82
  // @on-select="onSelect($event)"
73
- // :isLoading="true"
74
83
  // />
75
84
  // options to pass:
76
85
  // listOptions: [
@@ -133,7 +142,8 @@ const PageContainer = styled('div', PageContainerAttrs)`
133
142
  width: 30px;
134
143
  height: 30px;
135
144
  border-radius: 4px;
136
- background-color: ${(props) => props.activated ? props.theme.colors.grey5 : ''};
145
+ background-color: ${(props) =>
146
+ props.activated ? props.theme.colors.grey5 : ''};
137
147
 
138
148
  &:hover {
139
149
  background-color: ${(props) => props.theme.colors.grey5};
@@ -182,19 +192,18 @@ const LoadingContainer = styled.div`
182
192
  background: #fff;
183
193
  `
184
194
 
185
- const OptionsContainer = styled.div`
195
+ const OptionsContainerAttrs = { textWrap: Boolean }
196
+ const OptionsContainer = styled('div', OptionsContainerAttrs)`
186
197
  border: 1px solid ${(props) => props.theme.colors.grey3};
187
198
  display: grid;
188
199
  grid-template-columns: 1fr;
189
- min-width: 220px;
190
- max-width: 220px;
191
- width: max-content;
200
+ ${(props) => props.textWrap ? 'width: 220px' : 'width: max-content' };
192
201
  border-radius: 4px;
193
202
  background-color: #fff;
194
203
  max-height: 220px;
195
204
  overflow: auto;
196
205
  height: max-content;
197
- white-space: normal;
206
+ ${(props) => props.textWrap ? 'white-space: normal' : 'white-space: nowrap'};
198
207
  `
199
208
 
200
209
  const optionAttrs = { isDisabled: Boolean }
@@ -203,6 +212,8 @@ const OptionItem = styled('div', optionAttrs)`
203
212
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
204
213
  font-size: 13px;
205
214
  position: relative;
215
+ ${(props) => (props.isDisabled ? `background-color: ${ props.theme.colors.grey5 }!important` : '')};
216
+ ${(props) => (props.isDisabled ? `color: ${ props.theme.colors.grey2 }` : '')};
206
217
 
207
218
  &:hover {
208
219
  background-color: #ebeef4;
@@ -284,6 +295,10 @@ export default {
284
295
  isLoading: {
285
296
  required: false,
286
297
  default: false
298
+ },
299
+ textWrap: {
300
+ required: false,
301
+ default: true
287
302
  }
288
303
  },
289
304
  data() {
@@ -317,21 +332,28 @@ export default {
317
332
  const positionArray = this.determineElementQuarter(button, rectButton)
318
333
  contextMenu.style.transform = ''
319
334
  if (positionArray.includes('left')) {
320
- contextMenu.style.left = (rectButton.right - rectRelativeParent.left + 5) + 'px'
335
+ contextMenu.style.left =
336
+ rectButton.right - rectRelativeParent.left + 5 + 'px'
321
337
  } else {
322
- contextMenu.style.left = (rectButton.left - rectRelativeParent.left - 5) + 'px'
338
+ contextMenu.style.left =
339
+ rectButton.left - rectRelativeParent.left - 5 + 'px'
323
340
  contextMenu.style.transform = 'translateX(-100%)'
324
341
  }
325
342
  if (positionArray.includes('top')) {
326
- contextMenu.style.top = (rectButton.top - rectRelativeParent.top) + 'px'
343
+ contextMenu.style.top = rectButton.top - rectRelativeParent.top + 'px'
327
344
  } else {
328
- contextMenu.style.top = (rectButton.bottom - rectRelativeParent.top) + 'px'
345
+ contextMenu.style.top =
346
+ rectButton.bottom - rectRelativeParent.top + 'px'
329
347
  contextMenu.style.transform += ' translateY(-100%)'
330
348
  }
331
349
  },
332
350
  findRelativeParent(element) {
333
351
  while (element.parentElement) {
334
- if (window.getComputedStyle(element.parentElement).position === 'relative' || window.getComputedStyle(element.parentElement).position === 'absolute') {
352
+ if (
353
+ window.getComputedStyle(element.parentElement).position ===
354
+ 'relative' ||
355
+ window.getComputedStyle(element.parentElement).position === 'absolute'
356
+ ) {
335
357
  return element.parentElement
336
358
  }
337
359
  element = element.parentElement
@@ -368,6 +390,7 @@ export default {
368
390
  },
369
391
  onSelect({ item, hasChildren }) {
370
392
  if (hasChildren || item.disabled) {
393
+ this.$emit('on-click', item)
371
394
  return
372
395
  }
373
396
  this.$emit('on-select', item)
package/src/main.js CHANGED
@@ -1,6 +1,6 @@
1
- import Vue from "vue"
2
- import App from "./App.vue"
3
- import VueCompositionAPI from "@vue/composition-api"
1
+ import Vue from 'vue'
2
+ import App from './App.vue'
3
+ import VueCompositionAPI from '@vue/composition-api'
4
4
  import vClickOutside from 'v-click-outside'
5
5
 
6
6
  Vue.config.productionTip = false
@@ -9,5 +9,5 @@ Vue.use(VueCompositionAPI)
9
9
  Vue.use(vClickOutside)
10
10
 
11
11
  new Vue({
12
- render: (h) => h(App),
13
- }).$mount("#app")
12
+ render: (h) => h(App)
13
+ }).$mount('#app')