@eturnity/eturnity_reusable_components 6.33.1-EPDM-5205.1 → 6.33.1-EPDM-6487
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
@@ -311,7 +311,8 @@ export default {
|
|
311
311
|
return {
|
312
312
|
textInput: '',
|
313
313
|
isFocused: false,
|
314
|
-
warningIcon: warningIcon
|
314
|
+
warningIcon: warningIcon,
|
315
|
+
isBlurred: false
|
315
316
|
}
|
316
317
|
},
|
317
318
|
props: {
|
@@ -488,7 +489,9 @@ export default {
|
|
488
489
|
return num
|
489
490
|
}
|
490
491
|
})
|
491
|
-
let evaluated
|
492
|
+
let evaluated
|
493
|
+
formatted = this.removeStringItemsAfterLastNumber(formatted)
|
494
|
+
evaluated = eval(formatted.join(' '))
|
492
495
|
if (typeof evaluated === 'string') {
|
493
496
|
evaluated = stringToNumber({
|
494
497
|
value: evaluated,
|
@@ -499,7 +502,32 @@ export default {
|
|
499
502
|
}
|
500
503
|
return evaluated
|
501
504
|
},
|
505
|
+
removeStringItemsAfterLastNumber(array) {
|
506
|
+
// fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
|
507
|
+
let lastNumberIndex = -1
|
508
|
+
// Find the index of the last number in the array
|
509
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
510
|
+
if (typeof array[i] === 'number') {
|
511
|
+
lastNumberIndex = i
|
512
|
+
break
|
513
|
+
}
|
514
|
+
}
|
515
|
+
// if there are no numbers, return an empty array
|
516
|
+
if (lastNumberIndex === -1) {
|
517
|
+
return []
|
518
|
+
}
|
519
|
+
// Remove non-numeric items after the last number
|
520
|
+
if (lastNumberIndex !== -1) {
|
521
|
+
const newArray = array.slice(0, lastNumberIndex + 1)
|
522
|
+
return newArray
|
523
|
+
}
|
524
|
+
return array
|
525
|
+
},
|
502
526
|
onInput(value) {
|
527
|
+
if (this.isBlurred) {
|
528
|
+
this.isBlurred = false
|
529
|
+
return
|
530
|
+
}
|
503
531
|
if (value === '') {
|
504
532
|
this.$emit('on-input', '')
|
505
533
|
}
|
@@ -514,6 +542,8 @@ export default {
|
|
514
542
|
},
|
515
543
|
onInputBlur(e) {
|
516
544
|
this.isFocused = false
|
545
|
+
// setting isBlurred so we don't trigger onInput as well
|
546
|
+
this.isBlurred = true
|
517
547
|
let value = e.target.value
|
518
548
|
let evaluatedInput = this.onEvaluateCode(value)
|
519
549
|
this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
|
@@ -104,7 +104,12 @@
|
|
104
104
|
:src="require('../../assets/icons/collapse_arrow_icon.svg')"
|
105
105
|
/>
|
106
106
|
</arrow-wrapper>
|
107
|
-
<options-container
|
107
|
+
<options-container
|
108
|
+
v-if="isOpen"
|
109
|
+
:top="getItemLocation('top')"
|
110
|
+
:left="getItemLocation('left')"
|
111
|
+
ref="optionsContainer"
|
112
|
+
>
|
108
113
|
<options-wrapper @click.prevent.stop>
|
109
114
|
<search-container @click.prevent.stop>
|
110
115
|
<search-input
|
@@ -283,7 +288,8 @@ const OptionsContainer = styled('div', optionsAttrs)`
|
|
283
288
|
position: absolute;
|
284
289
|
display: grid;
|
285
290
|
grid-template-rows: 1fr auto;
|
286
|
-
|
291
|
+
top: ${(props) => props.top + 'px'};
|
292
|
+
left: ${(props) => props.left + 'px'};
|
287
293
|
width: auto;
|
288
294
|
max-height: 360px;
|
289
295
|
min-height: 200px;
|
@@ -504,13 +510,8 @@ export default {
|
|
504
510
|
}
|
505
511
|
},
|
506
512
|
methods: {
|
507
|
-
toggleOpen(
|
508
|
-
if (
|
509
|
-
this.isDisabled ||
|
510
|
-
(event &&
|
511
|
-
!(event.target === this.$el) &&
|
512
|
-
!this.$el.contains(event.target))
|
513
|
-
) {
|
513
|
+
toggleOpen() {
|
514
|
+
if (this.disabled) {
|
514
515
|
return
|
515
516
|
}
|
516
517
|
this.wasClicked = false
|
@@ -557,6 +558,14 @@ export default {
|
|
557
558
|
this.inputText = value
|
558
559
|
this.$emit('dropdown-search', value)
|
559
560
|
},
|
561
|
+
getItemLocation(value) {
|
562
|
+
let ref = this.$refs.dropdownItem[0]
|
563
|
+
let location = ref.$el.getBoundingClientRect()[value]
|
564
|
+
if (value === 'top') {
|
565
|
+
location = location + window.scrollY + 40
|
566
|
+
}
|
567
|
+
return location
|
568
|
+
},
|
560
569
|
clickOutside(event) {
|
561
570
|
if (event.target === this.$el || this.$el.contains(event.target)) {
|
562
571
|
return
|
@@ -1,15 +1,9 @@
|
|
1
1
|
<template>
|
2
|
-
<page-container
|
3
|
-
:tableHeight="tableHeight"
|
4
|
-
:shouldSetCustomHeight="doesTableContainDraggables"
|
5
|
-
>
|
2
|
+
<page-container>
|
6
3
|
<table-title v-if="titleText">
|
7
4
|
{{ titleText }}
|
8
5
|
</table-title>
|
9
|
-
<table-scroll
|
10
|
-
ref="tableRef"
|
11
|
-
:isPositionAbsolute="doesTableContainDraggables"
|
12
|
-
>
|
6
|
+
<table-scroll>
|
13
7
|
<table-wrapper :fullWidth="fullWidth">
|
14
8
|
<spinner-wrapper v-if="isLoading">
|
15
9
|
<spinner />
|
@@ -32,15 +26,7 @@
|
|
32
26
|
import styled from 'vue-styled-components'
|
33
27
|
import Spinner from '../../spinner'
|
34
28
|
|
35
|
-
const
|
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
|
-
`
|
29
|
+
const PageContainer = styled.div``
|
44
30
|
|
45
31
|
const TableTitle = styled.div`
|
46
32
|
margin-bottom: 16px;
|
@@ -49,27 +35,15 @@ const TableTitle = styled.div`
|
|
49
35
|
text-transform: uppercase;
|
50
36
|
`
|
51
37
|
|
52
|
-
const
|
53
|
-
isPositionAbsolute: Boolean
|
54
|
-
}
|
55
|
-
|
56
|
-
const TableScroll = styled('div', tableScrollProps)`
|
38
|
+
const TableScroll = styled.div`
|
57
39
|
max-width: 100%;
|
58
|
-
height: auto;
|
59
|
-
${(props) =>
|
60
|
-
props.isPositionAbsolute &&
|
61
|
-
`
|
62
|
-
position: absolute;
|
63
|
-
left: -20px;
|
64
|
-
`}
|
65
40
|
`
|
66
41
|
|
67
42
|
const wrapperAttrs = { fullWidth: Boolean }
|
68
43
|
const TableWrapper = styled('div', wrapperAttrs)`
|
69
44
|
width: ${(props) => (props.fullWidth ? '100%' : 'fit-content')};
|
70
45
|
max-width: 100%;
|
71
|
-
overflow
|
72
|
-
overflow-y: hidden;
|
46
|
+
overflow: auto;
|
73
47
|
|
74
48
|
::-webkit-scrollbar {
|
75
49
|
height: 5px; //height of the whole scrollbar area
|
@@ -93,11 +67,7 @@ const SpinnerWrapper = styled.div`
|
|
93
67
|
justify-items: center;
|
94
68
|
`
|
95
69
|
|
96
|
-
const containerAttrs = {
|
97
|
-
cellPaddings: String,
|
98
|
-
tableCursor: String
|
99
|
-
}
|
100
|
-
|
70
|
+
const containerAttrs = { cellPaddings: String, tableCursor: String }
|
101
71
|
const TableContainer = styled('table', containerAttrs)`
|
102
72
|
width: 100%;
|
103
73
|
border-collapse: collapse;
|
@@ -408,39 +378,6 @@ export default {
|
|
408
378
|
tableCursor: {
|
409
379
|
required: false
|
410
380
|
}
|
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
|
-
}
|
444
381
|
}
|
445
382
|
}
|
446
383
|
</script>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
<dropdown-container
|
9
9
|
v-if="isOpen"
|
10
10
|
@click.stop
|
11
|
+
:top="getItemLocation('top')"
|
12
|
+
:right="getItemLocation('right')"
|
11
13
|
:containerWidth="childOpen ? 440 : 240"
|
12
14
|
ref="dropdownContainer"
|
13
15
|
>
|
@@ -128,7 +130,6 @@ const PageContainer = styled.div`
|
|
128
130
|
justify-items: center;
|
129
131
|
width: 30px;
|
130
132
|
height: 30px;
|
131
|
-
position: relative;
|
132
133
|
|
133
134
|
&:hover {
|
134
135
|
background-color: ${(props) => props.theme.colors.grey5};
|
@@ -157,15 +158,12 @@ const DotItem = styled.div`
|
|
157
158
|
border-radius: 50%;
|
158
159
|
`
|
159
160
|
|
160
|
-
const dropdownAttrs = {
|
161
|
-
containerWidth: Number
|
162
|
-
}
|
161
|
+
const dropdownAttrs = { top: Number, right: Number, containerWidth: Number }
|
163
162
|
const DropdownContainer = styled('div', dropdownAttrs)`
|
164
163
|
z-index: 99;
|
165
164
|
height: 200px;
|
166
|
-
top:
|
167
|
-
|
168
|
-
|
165
|
+
top: ${(props) => props.top + 'px'};
|
166
|
+
left: ${(props) => props.right - props.containerWidth + 'px'};
|
169
167
|
position: absolute;
|
170
168
|
display: grid;
|
171
169
|
grid-template-columns: auto auto;
|
@@ -301,6 +299,14 @@ export default {
|
|
301
299
|
document.removeEventListener('click', this.clickOutside)
|
302
300
|
}
|
303
301
|
},
|
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
|
+
},
|
304
310
|
hasChildren(item) {
|
305
311
|
return !!item.children && !!item.children.length
|
306
312
|
},
|