@eturnity/eturnity_reusable_components 7.24.3-EPDM-11143.1 → 7.24.3-EPDM-10647.1

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.24.3-EPDM-11143.1",
3
+ "version": "7.24.3-EPDM-10647.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -14,6 +14,7 @@
14
14
  :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
15
15
  :alignArrow="alignArrow"
16
16
  :iconSize="size"
17
+ :maxWidth="maxWidth"
17
18
  ><slot />
18
19
  <span v-html="text"></span>
19
20
  </text-overlay>
@@ -52,7 +53,7 @@ const TextOverlay = styled('div', textAttrs)`
52
53
  background: ${(props) => props.theme.colors.black};
53
54
  padding: 10px;
54
55
  width: ${(props) => props.width};
55
- max-width: 400px;
56
+ max-width: ${(props) => props.maxWidth};
56
57
  font-size: 13px;
57
58
  font-weight: 400;
58
59
  line-height: normal;
@@ -124,6 +125,10 @@ export default {
124
125
  width: {
125
126
  required: false,
126
127
  default: '165px'
128
+ },
129
+ maxWidth: {
130
+ type: String,
131
+ default: '400px'
127
132
  }
128
133
  },
129
134
  methods: {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component-wrapper>
2
+ <component-wrapper @click.stop>
3
3
  <container
4
4
  :checkColor="checkColor"
5
5
  :size="size"
@@ -63,9 +63,35 @@
63
63
  :isError="isError"
64
64
  >{{ unitName }}</unit-container
65
65
  >
66
- <icon-wrapper v-if="isError && !showLinearUnitName" size="16px">
66
+ <icon-wrapper
67
+ v-if="isError && !showLinearUnitName"
68
+ size="16px"
69
+ :marginRight="showSelect ? selectWidth : 0"
70
+ >
67
71
  <icon name="warning" size="16px" cursor="default" />
68
72
  </icon-wrapper>
73
+ <select-wrapper v-if="showSelect">
74
+ <divider />
75
+ <Select
76
+ :showBorder="false"
77
+ :selectWidth="`${selectWidth}px`"
78
+ :disabled="isSelectDisabled"
79
+ @input-change="$emit('select-change', $event)"
80
+ >
81
+ <template #selector>
82
+ <select-text>{{ getSelectValue }}</select-text>
83
+ </template>
84
+ <template #dropdown>
85
+ <Option
86
+ v-for="item in selectOptions"
87
+ :key="item.value"
88
+ :value="item.value"
89
+ >
90
+ {{ item.label }}
91
+ </Option>
92
+ </template>
93
+ </Select>
94
+ </select-wrapper>
69
95
  </input-wrapper>
70
96
  <error-message v-if="isError">{{ errorMessage }}</error-message>
71
97
  </container>
@@ -107,6 +133,8 @@ import {
107
133
  } from '../../../helpers/numberConverter'
108
134
  import InfoText from '../../infoText'
109
135
  import ErrorMessage from '../../errorMessage'
136
+ import Select from '../select'
137
+ import Option from '../select/option'
110
138
  import warningIcon from '../../../assets/icons/error_icon.png'
111
139
  import Icon from '../../icon'
112
140
 
@@ -282,16 +310,35 @@ const LabelText = styled('div', inputProps)`
282
310
  font-weight: 700;
283
311
  `
284
312
 
285
- const IconAttrs = { size: String }
313
+ const IconAttrs = { size: String, marginRight: Number }
286
314
  const IconWrapper = styled('div', IconAttrs)`
287
315
  position: absolute;
288
316
  top: 0;
289
317
  bottom: 0;
290
318
  margin: auto;
291
- right: 5px;
319
+ right: ${(props) => props.marginRight + 10}px;
292
320
  height: ${(props) => (props.size ? props.size : 'auto')};
293
321
  `
294
322
 
323
+ const SelectText = styled.div`
324
+ font-size: 13px;
325
+ `
326
+
327
+ const SelectWrapper = styled.div`
328
+ position: absolute;
329
+ top: 2px;
330
+ right: 2px;
331
+ display: flex;
332
+ height: 100%;
333
+ `
334
+
335
+ const Divider = styled.div`
336
+ margin-top: 6px;
337
+ height: calc(100% - 16px);
338
+ width: 1px;
339
+ background-color: ${({ theme }) => theme.colors.grey4};
340
+ `
341
+
295
342
  export default {
296
343
  name: 'input-number',
297
344
  components: {
@@ -306,7 +353,12 @@ export default {
306
353
  InfoText,
307
354
  Icon,
308
355
  SlotContainer,
309
- IconWrapper
356
+ IconWrapper,
357
+ Select,
358
+ Option,
359
+ SelectWrapper,
360
+ SelectText,
361
+ Divider
310
362
  },
311
363
  inheritAttrs: false,
312
364
  data() {
@@ -450,6 +502,26 @@ export default {
450
502
  inputDataId: {
451
503
  required: false,
452
504
  default: ''
505
+ },
506
+ showSelect: {
507
+ type: Boolean,
508
+ default: false
509
+ },
510
+ selectWidth: {
511
+ type: Number,
512
+ default: 70
513
+ },
514
+ selectOptions: {
515
+ type: Array,
516
+ default: () => []
517
+ },
518
+ selectValue: {
519
+ type: [String, Number],
520
+ default: null
521
+ },
522
+ isSelectDisabled: {
523
+ type: Boolean,
524
+ default: false
453
525
  }
454
526
  },
455
527
  computed: {
@@ -464,6 +536,13 @@ export default {
464
536
  },
465
537
  hasLabelSlot() {
466
538
  return !!this.$slots.label
539
+ },
540
+ getSelectValue() {
541
+ const item = this.selectOptions.find(
542
+ ({ value }) => value === this.selectValue
543
+ )
544
+
545
+ return item ? item.label : '-'
467
546
  }
468
547
  },
469
548
  methods: {
@@ -22,10 +22,15 @@
22
22
  >
23
23
  </input-label>
24
24
  <info-text
25
- v-if="infoTextMessage"
25
+ v-if="infoTextMessage || !!this.$slots.infoText"
26
26
  :text="infoTextMessage"
27
27
  :size="infoTextSize"
28
- />
28
+ :alignArrow="infoTextAlignArrow"
29
+ :width="infoTextWidth"
30
+ :max-width="infoTextWidth"
31
+ >
32
+ <slot name="infoText" />
33
+ </info-text>
29
34
  </label-wrapper>
30
35
  <select-button-wrapper :disabled="disabled">
31
36
  <selectButton
@@ -172,6 +177,7 @@ import InfoText from '../../infoText'
172
177
  import icon from '../../icon'
173
178
  import inputText from '../inputText'
174
179
  import draggableInputHandle from '../../draggableInputHandle'
180
+ import { debounce } from '../../../utils'
175
181
 
176
182
  const CARET_WIDTH = '30px'
177
183
  const BORDER_WIDTH = '1px'
@@ -547,6 +553,14 @@ export default {
547
553
  dropdownMenuPosition: {
548
554
  type: String,
549
555
  default: DROPDOWN_MENU_POSITIONS.Automatic // options: ['automatic', bottom]
556
+ },
557
+ infoTextWidth: {
558
+ type: String,
559
+ required: false
560
+ },
561
+ infoTextAlignArrow: {
562
+ type: String,
563
+ required: false
550
564
  }
551
565
  },
552
566
 
@@ -631,9 +645,9 @@ export default {
631
645
  this.blur()
632
646
  this.$emit('input-change', e)
633
647
  },
634
- optionHovered(e) {
648
+ optionHovered: debounce(function (e) {
635
649
  this.hoveredValue = e
636
- },
650
+ }, 300),
637
651
  mouseEnterHandler() {
638
652
  if (this.hoverDropdown) {
639
653
  this.focus()
@@ -0,0 +1,12 @@
1
+ export function debounce(fn, wait) {
2
+ let timer
3
+ return function (...args) {
4
+ if (timer) {
5
+ clearTimeout(timer)
6
+ }
7
+ const context = this
8
+ timer = setTimeout(() => {
9
+ fn.apply(context, args)
10
+ }, wait)
11
+ }
12
+ }
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
- <svg width="800px" height="800px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
- <g id="copy" fill="none" transform="translate(85.333333, 42.666667)">
6
- <path d="M341.333333,85.3333333 L341.333333,405.333333 L85.3333333,405.333333 L85.3333333,85.3333333 L341.333333,85.3333333 Z M298.666667,128 L128,128 L128,362.666667 L298.666667,362.666667 L298.666667,128 Z M234.666667,7.10542736e-15 L234.666667,42.6666667 L42.6666667,42.6666667 L42.6666667,298.666667 L1.42108547e-14,298.666667 L1.42108547e-14,7.10542736e-15 L234.666667,7.10542736e-15 Z">
7
- </path>
8
- </g>
9
- </g>
10
- </svg>