@eturnity/eturnity_reusable_components 7.24.3 → 7.30.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 +1 -1
- package/src/components/buttons/mainButton/index.vue +2 -2
- package/src/components/filter/filterSettings.vue +1 -1
- package/src/components/icon/index.vue +3 -2
- package/src/components/infoCard/index.vue +8 -1
- package/src/components/infoText/index.vue +6 -1
- package/src/components/inputs/checkbox/index.vue +1 -1
- package/src/components/inputs/inputNumber/index.vue +78 -4
- package/src/components/inputs/select/index.vue +32 -11
- package/src/components/pageTitle/index.vue +1 -1
- package/src/components/spinner/index.vue +1 -1
- package/src/components/tables/mainTable/index.vue +47 -1
- package/src/components/tabsHeader/index.vue +83 -0
package/package.json
CHANGED
@@ -20,8 +20,8 @@
|
|
20
20
|
|
21
21
|
<script>
|
22
22
|
// To use:
|
23
|
-
// import
|
24
|
-
// <
|
23
|
+
// import RCMainButton from "@eturnity/eturnity_reusable_components/src/components/buttons/mainButton"
|
24
|
+
// <RCMainButton
|
25
25
|
// text="Click Me"
|
26
26
|
// customColor="#ab5348"
|
27
27
|
// type="secondary" // primary, secondary, cancel
|
@@ -114,8 +114,9 @@ const IconImage = styled('div', {
|
|
114
114
|
svg path {
|
115
115
|
${({ theme, color }) => color && `fill: ${theme.colors[color] || color};`}
|
116
116
|
}
|
117
|
-
&:hover
|
118
|
-
${
|
117
|
+
&:hover svg path {
|
118
|
+
${({ theme, hoveredColor }) =>
|
119
|
+
hoveredColor && `fill: ${theme.colors[hoveredColor] || hoveredColor};`}
|
119
120
|
}
|
120
121
|
&:hover + div {
|
121
122
|
background-color: ${(props) => props.hoveredColor};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<info-container>
|
3
|
-
<icon name="info" size="24px" />
|
3
|
+
<icon name="info" size="24px" :color="color" />
|
4
4
|
<text-container>
|
5
5
|
<slot />
|
6
6
|
</text-container>
|
@@ -8,11 +8,13 @@
|
|
8
8
|
</template>
|
9
9
|
|
10
10
|
<script>
|
11
|
+
// import InfoCard from '@eturnity/eturnity_reusable_components/src/components/infoCard'
|
11
12
|
import styled from 'vue3-styled-components'
|
12
13
|
import Icon from '../icon'
|
13
14
|
|
14
15
|
const InfoContainer = styled.div`
|
15
16
|
display: flex;
|
17
|
+
align-items: center;
|
16
18
|
gap: 15px;
|
17
19
|
padding: 20px;
|
18
20
|
border: 1px dashed ${(props) => props.theme.colors.grey4};
|
@@ -30,6 +32,11 @@ export default {
|
|
30
32
|
Icon,
|
31
33
|
InfoContainer,
|
32
34
|
TextContainer
|
35
|
+
},
|
36
|
+
props: {
|
37
|
+
color: {
|
38
|
+
required: false
|
39
|
+
}
|
33
40
|
}
|
34
41
|
}
|
35
42
|
</script>
|
@@ -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:
|
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: {
|
@@ -63,9 +63,34 @@
|
|
63
63
|
:isError="isError"
|
64
64
|
>{{ unitName }}</unit-container
|
65
65
|
>
|
66
|
-
<icon-wrapper
|
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
|
+
@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>
|
69
94
|
</input-wrapper>
|
70
95
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
71
96
|
</container>
|
@@ -107,6 +132,8 @@ import {
|
|
107
132
|
} from '../../../helpers/numberConverter'
|
108
133
|
import InfoText from '../../infoText'
|
109
134
|
import ErrorMessage from '../../errorMessage'
|
135
|
+
import Select from '../select'
|
136
|
+
import Option from '../select/option'
|
110
137
|
import warningIcon from '../../../assets/icons/error_icon.png'
|
111
138
|
import Icon from '../../icon'
|
112
139
|
|
@@ -282,16 +309,35 @@ const LabelText = styled('div', inputProps)`
|
|
282
309
|
font-weight: 700;
|
283
310
|
`
|
284
311
|
|
285
|
-
const IconAttrs = { size: String }
|
312
|
+
const IconAttrs = { size: String, marginRight: Number }
|
286
313
|
const IconWrapper = styled('div', IconAttrs)`
|
287
314
|
position: absolute;
|
288
315
|
top: 0;
|
289
316
|
bottom: 0;
|
290
317
|
margin: auto;
|
291
|
-
right:
|
318
|
+
right: ${(props) => props.marginRight + 10}px;
|
292
319
|
height: ${(props) => (props.size ? props.size : 'auto')};
|
293
320
|
`
|
294
321
|
|
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
|
+
|
295
341
|
export default {
|
296
342
|
name: 'input-number',
|
297
343
|
components: {
|
@@ -306,7 +352,12 @@ export default {
|
|
306
352
|
InfoText,
|
307
353
|
Icon,
|
308
354
|
SlotContainer,
|
309
|
-
IconWrapper
|
355
|
+
IconWrapper,
|
356
|
+
Select,
|
357
|
+
Option,
|
358
|
+
SelectWrapper,
|
359
|
+
SelectText,
|
360
|
+
Divider
|
310
361
|
},
|
311
362
|
inheritAttrs: false,
|
312
363
|
data() {
|
@@ -450,6 +501,22 @@ export default {
|
|
450
501
|
inputDataId: {
|
451
502
|
required: false,
|
452
503
|
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
|
453
520
|
}
|
454
521
|
},
|
455
522
|
computed: {
|
@@ -464,6 +531,13 @@ export default {
|
|
464
531
|
},
|
465
532
|
hasLabelSlot() {
|
466
533
|
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 : '-'
|
467
541
|
}
|
468
542
|
},
|
469
543
|
methods: {
|
@@ -10,7 +10,11 @@
|
|
10
10
|
:alignItems="alignItems"
|
11
11
|
:noRelative="noRelative"
|
12
12
|
>
|
13
|
-
<label-wrapper
|
13
|
+
<label-wrapper
|
14
|
+
v-if="label"
|
15
|
+
:data-id="labelDataId"
|
16
|
+
:infoTextMessage="!!infoTextMessage"
|
17
|
+
>
|
14
18
|
<input-label
|
15
19
|
:fontColor="
|
16
20
|
labelFontColor || colorMode == 'dark' ? 'white' : 'eturnityGrey'
|
@@ -22,10 +26,15 @@
|
|
22
26
|
>
|
23
27
|
</input-label>
|
24
28
|
<info-text
|
25
|
-
v-if="infoTextMessage"
|
29
|
+
v-if="infoTextMessage || !!this.$slots.infoText"
|
26
30
|
:text="infoTextMessage"
|
27
31
|
:size="infoTextSize"
|
28
|
-
|
32
|
+
:alignArrow="infoTextAlignArrow"
|
33
|
+
:width="infoTextWidth"
|
34
|
+
:max-width="infoTextWidth"
|
35
|
+
>
|
36
|
+
<slot name="infoText" />
|
37
|
+
</info-text>
|
29
38
|
</label-wrapper>
|
30
39
|
<select-button-wrapper :disabled="disabled">
|
31
40
|
<selectButton
|
@@ -44,7 +53,7 @@
|
|
44
53
|
"
|
45
54
|
:fontSize="fontSize"
|
46
55
|
:hasError="hasError"
|
47
|
-
:hasNoPadding="
|
56
|
+
:hasNoPadding="hasNoPadding"
|
48
57
|
:disabled="disabled"
|
49
58
|
@keydown="onKeyDown"
|
50
59
|
:showBorder="showBorder"
|
@@ -153,7 +162,7 @@
|
|
153
162
|
// alignItems="vertical"
|
154
163
|
// label-data-id="test-label-data-id"
|
155
164
|
// data-id="test-data-id"
|
156
|
-
// :
|
165
|
+
// :hasNoPadding="true"
|
157
166
|
// >
|
158
167
|
// <template #selector="{selectedValue}">
|
159
168
|
// value selected: {{selectedValue}}
|
@@ -231,9 +240,12 @@ const Container = styled('div', inputProps)`
|
|
231
240
|
position: ${(props) => (props.noRelative ? 'static' : 'relative')};
|
232
241
|
display: inline-block;
|
233
242
|
`
|
234
|
-
|
243
|
+
|
244
|
+
const LabelWrapperAttrs = { infoTextMessage: Boolean }
|
245
|
+
const LabelWrapper = styled('div', LabelWrapperAttrs)`
|
235
246
|
display: inline-grid;
|
236
|
-
grid-template-columns:
|
247
|
+
grid-template-columns: ${(props) =>
|
248
|
+
props.infoTextMessage ? 'auto auto' : 'auto'};
|
237
249
|
grid-gap: 12px;
|
238
250
|
align-items: center;
|
239
251
|
justify-content: start;
|
@@ -521,10 +533,6 @@ export default {
|
|
521
533
|
type: String,
|
522
534
|
default: ''
|
523
535
|
},
|
524
|
-
hasSelectButtonPadding: {
|
525
|
-
type: Boolean,
|
526
|
-
default: true
|
527
|
-
},
|
528
536
|
isDraggable: {
|
529
537
|
type: Boolean,
|
530
538
|
default: false
|
@@ -547,6 +555,19 @@ export default {
|
|
547
555
|
dropdownMenuPosition: {
|
548
556
|
type: String,
|
549
557
|
default: DROPDOWN_MENU_POSITIONS.Automatic // options: ['automatic', bottom]
|
558
|
+
},
|
559
|
+
hasNoPadding: {
|
560
|
+
required: false,
|
561
|
+
default: false,
|
562
|
+
type: Boolean
|
563
|
+
},
|
564
|
+
infoTextWidth: {
|
565
|
+
type: String,
|
566
|
+
required: false
|
567
|
+
},
|
568
|
+
infoTextAlignArrow: {
|
569
|
+
type: String,
|
570
|
+
required: false
|
550
571
|
}
|
551
572
|
},
|
552
573
|
|
@@ -31,7 +31,7 @@ const titleAttrs = { color: String, fontSize: String, uppercase: Boolean }
|
|
31
31
|
const TitleText = styled('span', titleAttrs)`
|
32
32
|
color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
|
33
33
|
font-weight: bold;
|
34
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize : '
|
34
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '20px')};
|
35
35
|
text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
|
36
36
|
`
|
37
37
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</template>
|
11
11
|
|
12
12
|
<script>
|
13
|
-
// import
|
13
|
+
// import RCSpinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
14
14
|
// <spinner size="30px" />
|
15
15
|
import styled from 'vue3-styled-components'
|
16
16
|
import SpinnerSvg from '../../assets/icons/black_spinner.svg?component'
|
@@ -18,6 +18,8 @@
|
|
18
18
|
v-else
|
19
19
|
:cellPaddings="cellPaddings"
|
20
20
|
:tableCursor="tableCursor"
|
21
|
+
@mouseover="hasAimHover ? setHovers($event) : null"
|
22
|
+
@mouseleave="hasAimHover ? removeHoverClass : null"
|
21
23
|
>
|
22
24
|
<slot />
|
23
25
|
</table-container>
|
@@ -122,7 +124,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
122
124
|
|
123
125
|
tbody {
|
124
126
|
tr {
|
125
|
-
&:hover {
|
127
|
+
&:hover, td.hovered-column {
|
126
128
|
background-color: ${(props) => props.theme.colors.white};
|
127
129
|
cursor: ${(props) => (props.tableCursor ? props.tableCursor : 'auto')};
|
128
130
|
|
@@ -406,6 +408,10 @@ export default {
|
|
406
408
|
required: false,
|
407
409
|
default: null
|
408
410
|
},
|
411
|
+
hasAimHover: {
|
412
|
+
required: false,
|
413
|
+
default: false
|
414
|
+
},
|
409
415
|
tableCursor: {
|
410
416
|
required: false
|
411
417
|
}
|
@@ -425,6 +431,46 @@ export default {
|
|
425
431
|
}
|
426
432
|
},
|
427
433
|
methods: {
|
434
|
+
findParentElementByTagName(element, tagName) {
|
435
|
+
let currentParentElement = element.parentElement
|
436
|
+
while (currentParentElement && currentParentElement.tagName !== tagName) {
|
437
|
+
currentParentElement = currentParentElement.parentElement
|
438
|
+
}
|
439
|
+
|
440
|
+
return currentParentElement && currentParentElement.tagName === tagName ? currentParentElement : null
|
441
|
+
},
|
442
|
+
removeHoverClass() {
|
443
|
+
const hoveredItems = document.querySelectorAll('.hovered-column')
|
444
|
+
hoveredItems.forEach((el) => {
|
445
|
+
el.classList.remove('hovered-column')
|
446
|
+
})
|
447
|
+
},
|
448
|
+
setHovers(event) {
|
449
|
+
this.removeHoverClass()
|
450
|
+
if (event.target.tagName !== 'TABLE' && event.target.tagName !== 'TH' && event.target.tagName !== 'TR') {
|
451
|
+
let hoveredCell = event.target
|
452
|
+
|
453
|
+
if (hoveredCell.tagName !== 'TD') {
|
454
|
+
// Looking for hovered TD element
|
455
|
+
hoveredCell = this.findParentElementByTagName(hoveredCell, 'TD')
|
456
|
+
}
|
457
|
+
|
458
|
+
if (hoveredCell) {
|
459
|
+
const rowChildren = Array.from(hoveredCell.parentElement.children)
|
460
|
+
const hoveredCellIndex = rowChildren.indexOf(hoveredCell)
|
461
|
+
const currentTable = this.findParentElementByTagName(hoveredCell, 'TABLE')
|
462
|
+
if (currentTable) {
|
463
|
+
const rowList = Array.from(currentTable.querySelectorAll('tr'))
|
464
|
+
rowList.forEach((el) => {
|
465
|
+
const cells = Array.from(el.children)
|
466
|
+
if (cells[hoveredCellIndex]) {
|
467
|
+
cells[hoveredCellIndex].classList.add('hovered-column')
|
468
|
+
}
|
469
|
+
})
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
},
|
428
474
|
observeTableHeight() {
|
429
475
|
if (!this.$refs.tableRef) return
|
430
476
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<template>
|
2
|
+
<PageContainer>
|
3
|
+
<TabsContainer>
|
4
|
+
<TabItem
|
5
|
+
v-for="item in tabsData"
|
6
|
+
:key="item.id"
|
7
|
+
:is-active="activeTab === item.id"
|
8
|
+
@click="onTabClick({ id: item.id })"
|
9
|
+
>
|
10
|
+
{{ item.text }}
|
11
|
+
</TabItem>
|
12
|
+
</TabsContainer>
|
13
|
+
</PageContainer>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
// import RCTabsHeader from "@eturnity/eturnity_reusable_components/src/components/tabsHeader"
|
18
|
+
// To use:
|
19
|
+
// <RCTabsHeader
|
20
|
+
// :activeTab="activeTabIndex" // should match the 'id'
|
21
|
+
// :tabsData="[
|
22
|
+
// {
|
23
|
+
// text: 'Tab 1',
|
24
|
+
// id: 0
|
25
|
+
// },
|
26
|
+
// {
|
27
|
+
// text: 'Tab 1',
|
28
|
+
// id: 1
|
29
|
+
// }
|
30
|
+
// ]"
|
31
|
+
// />
|
32
|
+
import styled from 'vue3-styled-components'
|
33
|
+
|
34
|
+
const PageContainer = styled.div``
|
35
|
+
|
36
|
+
const TabsContainer = styled.div`
|
37
|
+
display: flex;
|
38
|
+
cursor: pointer;
|
39
|
+
width: 100%;
|
40
|
+
`
|
41
|
+
|
42
|
+
const TabAttrs = { isActive: Boolean }
|
43
|
+
const TabItem = styled('div', TabAttrs)`
|
44
|
+
padding: 10px 20px;
|
45
|
+
font-size: 14px;
|
46
|
+
font-weight: 700;
|
47
|
+
background-color: ${(props) =>
|
48
|
+
props.isActive ? props.theme.colors.grey5 : props.theme.colors.white};
|
49
|
+
border-top: 3px solid
|
50
|
+
${(props) =>
|
51
|
+
props.isActive
|
52
|
+
? props.theme.colors.brightBlue
|
53
|
+
: props.theme.colors.grey4};
|
54
|
+
flex-grow: 1;
|
55
|
+
`
|
56
|
+
|
57
|
+
export default {
|
58
|
+
name: 'RCTabsHeader',
|
59
|
+
components: {
|
60
|
+
PageContainer,
|
61
|
+
TabsContainer,
|
62
|
+
TabItem
|
63
|
+
},
|
64
|
+
props: {
|
65
|
+
tabsData: {
|
66
|
+
required: true,
|
67
|
+
type: Array
|
68
|
+
},
|
69
|
+
activeTab: {
|
70
|
+
required: true,
|
71
|
+
type: Number
|
72
|
+
}
|
73
|
+
},
|
74
|
+
methods: {
|
75
|
+
onTabClick({ id }) {
|
76
|
+
if (id === this.activeTab) {
|
77
|
+
return
|
78
|
+
}
|
79
|
+
this.$emit('on-tab-change', id)
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
</script>
|