@eturnity/eturnity_reusable_components 7.24.1-EPDM-10647.0 → 7.24.1-EPDM-10857.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.24.1-EPDM-10647.0",
3
+ "version": "7.24.1-EPDM-10857.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <div>
3
+ <Text :expand="showButton && showAll" :fontSize="fontSize">{{ text }}</Text>
4
+ <ToggleContainer>
5
+ <ToggleButton
6
+ @click="toggleHandler"
7
+ v-if="showButton && !showAll"
8
+ :fontSize="fontSize"
9
+ >
10
+ {{ $gettext('Show more') }}
11
+ </ToggleButton>
12
+ <ToggleButton
13
+ @click="toggleHandler"
14
+ v-if="showButton && showAll"
15
+ :fontSize="fontSize"
16
+ >
17
+ {{ $gettext('Show less') }}
18
+ </ToggleButton>
19
+ </ToggleContainer>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ import styled from 'vue3-styled-components'
25
+ import theme from '@/assets/theme.js'
26
+
27
+ const TextAttrs = {
28
+ expand: Boolean,
29
+ fontSize: String
30
+ }
31
+ const Text = styled('p', TextAttrs)`
32
+ display: block;
33
+ display: -webkit-box;
34
+ line-height: 1.3em;
35
+ -webkit-line-clamp: ${(props) => (props.expand ? 'unset' : '4')};
36
+ -webkit-box-orient: vertical;
37
+ overflow: hidden;
38
+ font-size: ${(props) => props.fontSize}px;
39
+ text-overflow: ellipsis;
40
+ `
41
+
42
+ const ToggleContainer = styled.div`
43
+ display: flex;
44
+ width: 100%;
45
+ `
46
+
47
+ const ToggleButton = styled('p', TextAttrs)`
48
+ font-size: ${(props) => props.fontSize}px;
49
+ cursor: pointer;
50
+ color: ${(props) => props.theme.colors.blue};
51
+ `
52
+
53
+ export default {
54
+ name: 'collapsable-info-text',
55
+ props: {
56
+ text: {
57
+ type: String,
58
+ required: true
59
+ },
60
+ fontSize: {
61
+ type: String,
62
+ default: '16px'
63
+ },
64
+ lineCount: {
65
+ type: Number,
66
+ default: 3
67
+ },
68
+ minWidth: {
69
+ type: String,
70
+ default: '100%'
71
+ }
72
+ },
73
+ components: {
74
+ Text,
75
+ ToggleButton,
76
+ ToggleContainer
77
+ },
78
+ data() {
79
+ return {
80
+ showButton: true,
81
+ showAll: false,
82
+ lineBreaks: []
83
+ }
84
+ },
85
+ computed: {
86
+ theme() {
87
+ return theme
88
+ }
89
+ },
90
+ methods: {
91
+ displayText() {
92
+ if (!this.showButton) {
93
+ return this.text
94
+ }
95
+ if (!this.showAll) {
96
+ let countIndex = 0
97
+ this.lineBreaks.forEach((el, index) => {
98
+ if (index < this.lineCount) {
99
+ countIndex += el.length
100
+ }
101
+ })
102
+
103
+ return this.text.slice(0, countIndex + 2) + '...'
104
+ } else {
105
+ return this.text
106
+ }
107
+ },
108
+ toggleHandler() {
109
+ this.showAll = !this.showAll
110
+ }
111
+ },
112
+ created() {
113
+ // TODO: this should divide the text into lines based on with. Currently it's just splitting by line breaks
114
+ // this.lineBreaks = this.text.split('\n')
115
+
116
+ // if (this.lineBreaks.length <= this.lineCount) {
117
+ // this.showButton = false
118
+ // }
119
+
120
+ if (this.text.length <= 170) {
121
+ this.showButton = false
122
+ }
123
+ }
124
+ }
125
+ </script>
@@ -14,7 +14,6 @@
14
14
  :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
15
15
  :alignArrow="alignArrow"
16
16
  :iconSize="size"
17
- :maxWidth="maxWidth"
18
17
  ><slot />
19
18
  <span v-html="text"></span>
20
19
  </text-overlay>
@@ -53,7 +52,7 @@ const TextOverlay = styled('div', textAttrs)`
53
52
  background: ${(props) => props.theme.colors.black};
54
53
  padding: 10px;
55
54
  width: ${(props) => props.width};
56
- max-width: ${(props) => props.maxWidth};
55
+ max-width: 400px;
57
56
  font-size: 13px;
58
57
  font-weight: 400;
59
58
  line-height: normal;
@@ -125,10 +124,6 @@ export default {
125
124
  width: {
126
125
  required: false,
127
126
  default: '165px'
128
- },
129
- maxWidth: {
130
- type: String,
131
- default: '400px'
132
127
  }
133
128
  },
134
129
  methods: {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component-wrapper @click.stop>
2
+ <component-wrapper>
3
3
  <container
4
4
  :checkColor="checkColor"
5
5
  :size="size"
@@ -63,34 +63,9 @@
63
63
  :isError="isError"
64
64
  >{{ unitName }}</unit-container
65
65
  >
66
- <icon-wrapper
67
- v-if="isError && !showLinearUnitName"
68
- size="16px"
69
- :marginRight="showSelect ? selectWidth : 0"
70
- >
66
+ <icon-wrapper v-if="isError && !showLinearUnitName" size="16px">
71
67
  <icon name="warning" size="16px" cursor="default" />
72
68
  </icon-wrapper>
73
- <select-wrapper v-if="showSelect">
74
- <divider />
75
- <Select
76
- :showBorder="false"
77
- :selectWidth="`${selectWidth}px`"
78
- @input-change="$emit('select-change', $event)"
79
- >
80
- <template #selector>
81
- <select-text>{{ getSelectValue }}</select-text>
82
- </template>
83
- <template #dropdown>
84
- <Option
85
- v-for="item in selectOptions"
86
- :key="item.value"
87
- :value="item.value"
88
- >
89
- {{ item.label }}
90
- </Option>
91
- </template>
92
- </Select>
93
- </select-wrapper>
94
69
  </input-wrapper>
95
70
  <error-message v-if="isError">{{ errorMessage }}</error-message>
96
71
  </container>
@@ -132,8 +107,6 @@ import {
132
107
  } from '../../../helpers/numberConverter'
133
108
  import InfoText from '../../infoText'
134
109
  import ErrorMessage from '../../errorMessage'
135
- import Select from '../select'
136
- import Option from '../select/option'
137
110
  import warningIcon from '../../../assets/icons/error_icon.png'
138
111
  import Icon from '../../icon'
139
112
 
@@ -309,35 +282,16 @@ const LabelText = styled('div', inputProps)`
309
282
  font-weight: 700;
310
283
  `
311
284
 
312
- const IconAttrs = { size: String, marginRight: Number }
285
+ const IconAttrs = { size: String }
313
286
  const IconWrapper = styled('div', IconAttrs)`
314
287
  position: absolute;
315
288
  top: 0;
316
289
  bottom: 0;
317
290
  margin: auto;
318
- right: ${(props) => props.marginRight + 10}px;
291
+ right: 5px;
319
292
  height: ${(props) => (props.size ? props.size : 'auto')};
320
293
  `
321
294
 
322
- const SelectText = styled.div`
323
- font-size: 13px;
324
- `
325
-
326
- const SelectWrapper = styled.div`
327
- position: absolute;
328
- top: 2px;
329
- right: 2px;
330
- display: flex;
331
- height: 100%;
332
- `
333
-
334
- const Divider = styled.div`
335
- margin-top: 6px;
336
- height: calc(100% - 16px);
337
- width: 1px;
338
- background-color: ${({ theme }) => theme.colors.grey4};
339
- `
340
-
341
295
  export default {
342
296
  name: 'input-number',
343
297
  components: {
@@ -352,12 +306,7 @@ export default {
352
306
  InfoText,
353
307
  Icon,
354
308
  SlotContainer,
355
- IconWrapper,
356
- Select,
357
- Option,
358
- SelectWrapper,
359
- SelectText,
360
- Divider
309
+ IconWrapper
361
310
  },
362
311
  inheritAttrs: false,
363
312
  data() {
@@ -501,22 +450,6 @@ export default {
501
450
  inputDataId: {
502
451
  required: false,
503
452
  default: ''
504
- },
505
- showSelect: {
506
- type: Boolean,
507
- default: false
508
- },
509
- selectWidth: {
510
- type: Number,
511
- default: 70
512
- },
513
- selectOptions: {
514
- type: Array,
515
- default: () => []
516
- },
517
- selectValue: {
518
- type: [String, Number],
519
- default: null
520
453
  }
521
454
  },
522
455
  computed: {
@@ -531,13 +464,6 @@ export default {
531
464
  },
532
465
  hasLabelSlot() {
533
466
  return !!this.$slots.label
534
- },
535
- getSelectValue() {
536
- const item = this.selectOptions.find(
537
- ({ value }) => value === this.selectValue
538
- )
539
-
540
- return item ? item.label : '-'
541
467
  }
542
468
  },
543
469
  methods: {
@@ -22,15 +22,10 @@
22
22
  >
23
23
  </input-label>
24
24
  <info-text
25
- v-if="infoTextMessage || !!this.$slots.infoText"
25
+ v-if="infoTextMessage"
26
26
  :text="infoTextMessage"
27
27
  :size="infoTextSize"
28
- :alignArrow="infoTextAlignArrow"
29
- :width="infoTextWidth"
30
- :max-width="infoTextWidth"
31
- >
32
- <slot name="infoText" />
33
- </info-text>
28
+ />
34
29
  </label-wrapper>
35
30
  <select-button-wrapper :disabled="disabled">
36
31
  <selectButton
@@ -536,14 +531,6 @@ export default {
536
531
  dropdownMenuPosition: {
537
532
  type: String,
538
533
  default: DROPDOWN_MENU_POSITIONS.Automatic // options: ['automatic', bottom]
539
- },
540
- infoTextWidth: {
541
- type: String,
542
- required: false
543
- },
544
- infoTextAlignArrow: {
545
- type: String,
546
- required: false
547
534
  }
548
535
  },
549
536