@eturnity/eturnity_reusable_components 6.44.1 → 6.46.0
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/assets/theme.js +3 -3
- package/src/components/inputs/select/index.vue +14 -16
- package/src/components/inputs/select/option/index.vue +4 -4
- package/src/components/tableDropdown/index.vue +3 -17
- package/src/components/tables/mainTable/index.vue +69 -6
- package/src/components/threeDots/index.vue +7 -13
- package/src/helpers/numberConverter.js +16 -16
- package/src/helpers/translateLang.js +12 -0
package/package.json
CHANGED
package/src/assets/theme.js
CHANGED
@@ -3,7 +3,7 @@ const theme = {
|
|
3
3
|
primary: '#48a2d0',
|
4
4
|
secondary: '#fdb813',
|
5
5
|
tertiary: '#d5d5d5',
|
6
|
-
black: '#
|
6
|
+
black: '#263238',
|
7
7
|
yellow: '#fdb813',
|
8
8
|
darkGray: '#818181',
|
9
9
|
gray1: '#666',
|
@@ -20,8 +20,8 @@ const theme = {
|
|
20
20
|
grey5: '#fafafa',
|
21
21
|
grey6: '#555d61',
|
22
22
|
green: '#99db0c',
|
23
|
-
transparentWhite1:'#ffffff32',
|
24
|
-
transparentBlack1:'#263238e6',
|
23
|
+
transparentWhite1: '#ffffff32',
|
24
|
+
transparentBlack1: '#263238e6',
|
25
25
|
disabled: '#dfe1e1',
|
26
26
|
eturnityGrey: '#263238'
|
27
27
|
},
|
@@ -95,9 +95,7 @@
|
|
95
95
|
:hoveredIndex="hoveredIndex"
|
96
96
|
:isActive="isActive"
|
97
97
|
:optionWidth="optionWidth"
|
98
|
-
:
|
99
|
-
dropdownBgColor || colorMode == 'dark' ? 'black' : 'white'
|
100
|
-
"
|
98
|
+
:hoveredBgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
|
101
99
|
:fontColor="
|
102
100
|
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
103
101
|
"
|
@@ -154,7 +152,7 @@ const Selector = styled.div`
|
|
154
152
|
width: 100%;
|
155
153
|
`
|
156
154
|
|
157
|
-
const labelAttrs = { fontSize: String }
|
155
|
+
const labelAttrs = { fontSize: String, fontColor: String }
|
158
156
|
const InputLabel = styled('div', labelAttrs)`
|
159
157
|
color: ${(props) =>
|
160
158
|
props.theme.colors[props.fontColor]
|
@@ -234,7 +232,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
234
232
|
${(props) => (props.disabled ? 'pointer-events: none' : '')};
|
235
233
|
`
|
236
234
|
const selectDropdownAttrs = {
|
237
|
-
|
235
|
+
hoveredBgColor: String,
|
238
236
|
fontColor: String,
|
239
237
|
selectWidth: String,
|
240
238
|
optionWidth: String,
|
@@ -255,21 +253,20 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
255
253
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
256
254
|
width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
|
257
255
|
background-color:${(props) =>
|
258
|
-
props.theme.colors[props.
|
259
|
-
? props.theme.colors[props.
|
260
|
-
: props.
|
256
|
+
props.theme.colors[props.hoveredBgColor]
|
257
|
+
? props.theme.colors[props.hoveredBgColor]
|
258
|
+
: props.hoveredBgColor};
|
261
259
|
color:${(props) =>
|
262
260
|
props.theme.colors[props.fontColor]
|
263
261
|
? props.theme.colors[props.fontColor]
|
264
262
|
: props.fontColor};
|
265
|
-
max-height:
|
266
|
-
|
267
|
-
overflow-y: auto;
|
268
|
-
& [data-value="${(props) => props.selectedValue}"]{
|
269
|
-
backdrop-filter: brightness(1.4);
|
270
|
-
}
|
263
|
+
max-height:300px;
|
264
|
+
overflow-y:auto;
|
271
265
|
&>div:nth-child(${(props) => props.hoveredIndex}){
|
272
|
-
|
266
|
+
background-color:${(props) =>
|
267
|
+
props.theme.colors[props.hoveredBgColor]
|
268
|
+
? props.theme.colors[props.hoveredBgColor]
|
269
|
+
: props.hoveredBgColor};
|
273
270
|
}
|
274
271
|
`
|
275
272
|
const DropdownWrapper = styled('div')`
|
@@ -345,7 +342,8 @@ export default {
|
|
345
342
|
required: false
|
346
343
|
},
|
347
344
|
dropdownBgColor: {
|
348
|
-
required: false
|
345
|
+
required: false,
|
346
|
+
default: 'grey5'
|
349
347
|
},
|
350
348
|
dropdownFontColor: {
|
351
349
|
required: false
|
@@ -1,9 +1,8 @@
|
|
1
1
|
<template>
|
2
2
|
<optionContainer
|
3
3
|
:data-value="value"
|
4
|
-
:hoveredBgColor="
|
5
|
-
|
6
|
-
"
|
4
|
+
:hoveredBgColor="colorMode == 'dark' ? '#000000' : 'hoveredBgColor'"
|
5
|
+
:backgroundColor="colorMode == 'dark' ? '#000000' : '#fff'"
|
7
6
|
@click="clickHandler"
|
8
7
|
@mouseover="hoverHandler"
|
9
8
|
>
|
@@ -15,7 +14,7 @@
|
|
15
14
|
// import selectButton from './selectButton'
|
16
15
|
// import selectDropdown from './selectDropDown'
|
17
16
|
import styled from 'vue-styled-components'
|
18
|
-
const optionProps = { hoveredBgColor: String }
|
17
|
+
const optionProps = { hoveredBgColor: String, backgroundColor: String }
|
19
18
|
const optionContainer = styled('div', optionProps)`
|
20
19
|
display: flex;
|
21
20
|
cursor: pointer;
|
@@ -25,6 +24,7 @@ const optionContainer = styled('div', optionProps)`
|
|
25
24
|
padding: 12px 10px;
|
26
25
|
gap: 14px;
|
27
26
|
width: 100%;
|
27
|
+
background-color: ${(props) => props.backgroundColor};
|
28
28
|
box-sizing: inherit;
|
29
29
|
&:hover {
|
30
30
|
background-color: ${(props) =>
|
@@ -104,12 +104,7 @@
|
|
104
104
|
:src="require('../../assets/icons/collapse_arrow_icon.svg')"
|
105
105
|
/>
|
106
106
|
</arrow-wrapper>
|
107
|
-
<options-container
|
108
|
-
v-if="isOpen"
|
109
|
-
:top="getItemLocation('top')"
|
110
|
-
:left="getItemLocation('left')"
|
111
|
-
ref="optionsContainer"
|
112
|
-
>
|
107
|
+
<options-container v-if="isOpen" ref="optionsContainer">
|
113
108
|
<options-wrapper @click.prevent.stop>
|
114
109
|
<search-container @click.prevent.stop>
|
115
110
|
<search-input
|
@@ -288,8 +283,7 @@ const OptionsContainer = styled('div', optionsAttrs)`
|
|
288
283
|
position: absolute;
|
289
284
|
display: grid;
|
290
285
|
grid-template-rows: 1fr auto;
|
291
|
-
|
292
|
-
left: ${(props) => props.left + 'px'};
|
286
|
+
left: 20px;
|
293
287
|
width: auto;
|
294
288
|
max-height: 360px;
|
295
289
|
min-height: 200px;
|
@@ -512,7 +506,7 @@ export default {
|
|
512
506
|
methods: {
|
513
507
|
toggleOpen(event) {
|
514
508
|
if (
|
515
|
-
this.
|
509
|
+
this.disabled ||
|
516
510
|
(event &&
|
517
511
|
!(event.target === this.$el) &&
|
518
512
|
!this.$el.contains(event.target))
|
@@ -563,14 +557,6 @@ export default {
|
|
563
557
|
this.inputText = value
|
564
558
|
this.$emit('dropdown-search', value)
|
565
559
|
},
|
566
|
-
getItemLocation(value) {
|
567
|
-
let ref = this.$refs.dropdownItem[0]
|
568
|
-
let location = ref.$el.getBoundingClientRect()[value]
|
569
|
-
if (value === 'top') {
|
570
|
-
location = location + window.scrollY + 40
|
571
|
-
}
|
572
|
-
return location
|
573
|
-
},
|
574
560
|
clickOutside(event) {
|
575
561
|
if (event.target === this.$el || this.$el.contains(event.target)) {
|
576
562
|
return
|
@@ -1,9 +1,15 @@
|
|
1
1
|
<template>
|
2
|
-
<page-container
|
2
|
+
<page-container
|
3
|
+
:tableHeight="tableHeight"
|
4
|
+
:shouldSetCustomHeight="doesTableContainDraggables"
|
5
|
+
>
|
3
6
|
<table-title v-if="titleText">
|
4
7
|
{{ titleText }}
|
5
8
|
</table-title>
|
6
|
-
<table-scroll
|
9
|
+
<table-scroll
|
10
|
+
ref="tableRef"
|
11
|
+
:isPositionAbsolute="doesTableContainDraggables"
|
12
|
+
>
|
7
13
|
<table-wrapper :fullWidth="fullWidth">
|
8
14
|
<spinner-wrapper v-if="isLoading">
|
9
15
|
<spinner />
|
@@ -26,7 +32,15 @@
|
|
26
32
|
import styled from 'vue-styled-components'
|
27
33
|
import Spinner from '../../spinner'
|
28
34
|
|
29
|
-
const
|
35
|
+
const pageContainerProps = {
|
36
|
+
tableHeight: String,
|
37
|
+
shouldSetCustomHeight: Boolean
|
38
|
+
}
|
39
|
+
const PageContainer = styled('div', pageContainerProps)`
|
40
|
+
position: relative;
|
41
|
+
height: ${(props) =>
|
42
|
+
props.shouldSetCustomHeight ? props.tableHeight : 'auto'};
|
43
|
+
`
|
30
44
|
|
31
45
|
const TableTitle = styled.div`
|
32
46
|
margin-bottom: 16px;
|
@@ -35,15 +49,27 @@ const TableTitle = styled.div`
|
|
35
49
|
text-transform: uppercase;
|
36
50
|
`
|
37
51
|
|
38
|
-
const
|
52
|
+
const tableScrollProps = {
|
53
|
+
isPositionAbsolute: Boolean
|
54
|
+
}
|
55
|
+
|
56
|
+
const TableScroll = styled('div', tableScrollProps)`
|
39
57
|
max-width: 100%;
|
58
|
+
height: auto;
|
59
|
+
${(props) =>
|
60
|
+
props.isPositionAbsolute &&
|
61
|
+
`
|
62
|
+
position: absolute;
|
63
|
+
left: -20px;
|
64
|
+
`}
|
40
65
|
`
|
41
66
|
|
42
67
|
const wrapperAttrs = { fullWidth: Boolean }
|
43
68
|
const TableWrapper = styled('div', wrapperAttrs)`
|
44
69
|
width: ${(props) => (props.fullWidth ? '100%' : 'fit-content')};
|
45
70
|
max-width: 100%;
|
46
|
-
overflow: auto;
|
71
|
+
overflow-x: auto;
|
72
|
+
overflow-y: hidden;
|
47
73
|
|
48
74
|
::-webkit-scrollbar {
|
49
75
|
height: 5px; //height of the whole scrollbar area
|
@@ -67,7 +93,11 @@ const SpinnerWrapper = styled.div`
|
|
67
93
|
justify-items: center;
|
68
94
|
`
|
69
95
|
|
70
|
-
const containerAttrs = {
|
96
|
+
const containerAttrs = {
|
97
|
+
cellPaddings: String,
|
98
|
+
tableCursor: String
|
99
|
+
}
|
100
|
+
|
71
101
|
const TableContainer = styled('table', containerAttrs)`
|
72
102
|
width: 100%;
|
73
103
|
border-collapse: collapse;
|
@@ -378,6 +408,39 @@ export default {
|
|
378
408
|
tableCursor: {
|
379
409
|
required: false
|
380
410
|
}
|
411
|
+
},
|
412
|
+
data() {
|
413
|
+
return {
|
414
|
+
tableHeight: 'auto',
|
415
|
+
doesTableContainDraggables: false
|
416
|
+
}
|
417
|
+
},
|
418
|
+
mounted() {
|
419
|
+
this.observeTableHeight()
|
420
|
+
},
|
421
|
+
beforeDestroy() {
|
422
|
+
if (this.resizeObserver) {
|
423
|
+
this.resizeObserver.disconnect()
|
424
|
+
}
|
425
|
+
},
|
426
|
+
methods: {
|
427
|
+
observeTableHeight() {
|
428
|
+
if (!this.$refs.tableRef) return
|
429
|
+
|
430
|
+
const tableElement = this.$refs.tableRef.$el
|
431
|
+
|
432
|
+
this.resizeObserver = new ResizeObserver(() => {
|
433
|
+
const newTableHeight = this.titleText
|
434
|
+
? tableElement.offsetHeight + 33
|
435
|
+
: tableElement.offsetHeight
|
436
|
+
this.tableHeight = `${newTableHeight}px`
|
437
|
+
this.doesTableContainDraggables = Boolean(
|
438
|
+
tableElement.querySelector('.drag-container')
|
439
|
+
)
|
440
|
+
})
|
441
|
+
|
442
|
+
this.resizeObserver.observe(tableElement)
|
443
|
+
}
|
381
444
|
}
|
382
445
|
}
|
383
446
|
</script>
|
@@ -8,8 +8,6 @@
|
|
8
8
|
<dropdown-container
|
9
9
|
v-if="isOpen"
|
10
10
|
@click.stop
|
11
|
-
:top="getItemLocation('top')"
|
12
|
-
:right="getItemLocation('right')"
|
13
11
|
:containerWidth="childOpen ? 440 : 240"
|
14
12
|
ref="dropdownContainer"
|
15
13
|
>
|
@@ -130,6 +128,7 @@ const PageContainer = styled.div`
|
|
130
128
|
justify-items: center;
|
131
129
|
width: 30px;
|
132
130
|
height: 30px;
|
131
|
+
position: relative;
|
133
132
|
|
134
133
|
&:hover {
|
135
134
|
background-color: ${(props) => props.theme.colors.grey5};
|
@@ -158,12 +157,15 @@ const DotItem = styled.div`
|
|
158
157
|
border-radius: 50%;
|
159
158
|
`
|
160
159
|
|
161
|
-
const dropdownAttrs = {
|
160
|
+
const dropdownAttrs = {
|
161
|
+
containerWidth: Number
|
162
|
+
}
|
162
163
|
const DropdownContainer = styled('div', dropdownAttrs)`
|
163
164
|
z-index: 99;
|
164
165
|
height: 200px;
|
165
|
-
top:
|
166
|
-
|
166
|
+
top: 0;
|
167
|
+
right: 27px;
|
168
|
+
|
167
169
|
position: absolute;
|
168
170
|
display: grid;
|
169
171
|
grid-template-columns: auto auto;
|
@@ -299,14 +301,6 @@ export default {
|
|
299
301
|
document.removeEventListener('click', this.clickOutside)
|
300
302
|
}
|
301
303
|
},
|
302
|
-
getItemLocation(value) {
|
303
|
-
let ref = this.$refs.dropdownItem
|
304
|
-
let location = ref.$el.getBoundingClientRect()[value]
|
305
|
-
if (value === 'top') {
|
306
|
-
location = location + window.scrollY
|
307
|
-
}
|
308
|
-
return location
|
309
|
-
},
|
310
304
|
hasChildren(item) {
|
311
305
|
return !!item.children && !!item.children.length
|
312
306
|
},
|
@@ -1,12 +1,11 @@
|
|
1
|
+
import { langForLocaleString } from './translateLang'
|
2
|
+
|
1
3
|
export const stringToNumber = ({
|
2
|
-
value,
|
4
|
+
value = '',
|
3
5
|
numberPrecision = false,
|
4
|
-
allowNegative
|
6
|
+
allowNegative = false
|
5
7
|
}) => {
|
6
8
|
// This is for saving. It converts our input string to a readable number
|
7
|
-
if (value === undefined) {
|
8
|
-
value = ''
|
9
|
-
}
|
10
9
|
let newVal = value.toString()
|
11
10
|
const selectedLang = localStorage.getItem('lang')
|
12
11
|
// The first replace will replace not allowed characters with a blank
|
@@ -93,17 +92,18 @@ export const stringToNumber = ({
|
|
93
92
|
}
|
94
93
|
|
95
94
|
export const numberToString = ({ value, numberPrecision }) => {
|
96
|
-
let selectedLang = localStorage.getItem('lang')
|
97
|
-
? localStorage.getItem('lang') === 'fr-lu'
|
98
|
-
? 'fr-fr'
|
99
|
-
: localStorage.getItem('lang')
|
100
|
-
: 'en-US'
|
101
|
-
if (selectedLang == 'null') {
|
102
|
-
selectedLang = 'en-US'
|
103
|
-
}
|
104
95
|
value = parseFloat(value)
|
105
|
-
|
106
|
-
|
107
|
-
|
96
|
+
let minNumberPrecision
|
97
|
+
let maxNumberPrecision
|
98
|
+
if (typeof numberPrecision === 'number') {
|
99
|
+
minNumberPrecision = numberPrecision
|
100
|
+
maxNumberPrecision = numberPrecision
|
101
|
+
} else {
|
102
|
+
minNumberPrecision = numberPrecision[0]
|
103
|
+
maxNumberPrecision = numberPrecision[1]
|
104
|
+
}
|
105
|
+
return value.toLocaleString(langForLocaleString(), {
|
106
|
+
minimumFractionDigits: minNumberPrecision,
|
107
|
+
maximumFractionDigits: maxNumberPrecision
|
108
108
|
})
|
109
109
|
}
|
@@ -78,6 +78,7 @@ export const datePickerLang = (lang) => {
|
|
78
78
|
}
|
79
79
|
|
80
80
|
export const tinyLanguage = (lang) => {
|
81
|
+
// the function is used to pass correct language to Tiny MCE text editor https://www.tiny.cloud/docs/tinymce/6/ui-localization/#language
|
81
82
|
if (
|
82
83
|
lang === 'de' ||
|
83
84
|
lang === 'de-de' ||
|
@@ -106,3 +107,14 @@ export const tinyLanguage = (lang) => {
|
|
106
107
|
return langCode
|
107
108
|
}
|
108
109
|
}
|
110
|
+
|
111
|
+
export const langForLocaleString = () => {
|
112
|
+
const selectedLang = localStorage.getItem('lang')
|
113
|
+
? localStorage.getItem('lang') === 'fr-lu'
|
114
|
+
? 'fr-fr'
|
115
|
+
: localStorage.getItem('lang') === 'fr-ch'
|
116
|
+
? 'de-ch'
|
117
|
+
: localStorage.getItem('lang')
|
118
|
+
: 'en-US'
|
119
|
+
return selectedLang !== 'null' ? selectedLang : 'en-US'
|
120
|
+
}
|