@eturnity/eturnity_reusable_components 6.33.1-EPDM-5205.1 → 6.33.1-EPDM-7956

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.
Files changed (40) hide show
  1. package/.storybook/preview.js +1 -1
  2. package/package.json +15 -18
  3. package/src/App.vue +2 -2
  4. package/src/components/addNewButton/index.vue +1 -1
  5. package/src/components/buttons/buttonIcon/index.vue +1 -1
  6. package/src/components/buttons/closeButton/index.vue +1 -1
  7. package/src/components/buttons/mainButton/index.vue +1 -1
  8. package/src/components/deleteIcon/index.vue +1 -1
  9. package/src/components/dropdown/index.vue +129 -110
  10. package/src/components/errorMessage/index.vue +1 -1
  11. package/src/components/icon/iconCollection.vue +2 -2
  12. package/src/components/icon/index.vue +36 -42
  13. package/src/components/iconWrapper/index.vue +1 -1
  14. package/src/components/infoText/index.vue +2 -6
  15. package/src/components/inputs/checkbox/index.vue +1 -1
  16. package/src/components/inputs/inputNumber/index.vue +1 -2
  17. package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
  18. package/src/components/inputs/inputText/index.vue +3 -3
  19. package/src/components/inputs/radioButton/index.vue +1 -1
  20. package/src/components/inputs/searchInput/index.vue +1 -1
  21. package/src/components/inputs/select/index.vue +22 -28
  22. package/src/components/inputs/select/option/index.vue +1 -1
  23. package/src/components/inputs/slider/index.vue +1 -1
  24. package/src/components/inputs/switchField/index.vue +1 -1
  25. package/src/components/inputs/textAreaInput/index.vue +1 -1
  26. package/src/components/inputs/toggle/index.vue +1 -1
  27. package/src/components/modals/modal/index.vue +1 -1
  28. package/src/components/pageSubtitle/index.vue +1 -1
  29. package/src/components/pageTitle/index.vue +1 -1
  30. package/src/components/pagination/index.vue +12 -12
  31. package/src/components/progressBar/index.vue +1 -1
  32. package/src/components/projectMarker/index.vue +1 -1
  33. package/src/components/spinner/index.vue +1 -1
  34. package/src/components/tableDropdown/index.vue +22 -13
  35. package/src/components/tables/mainTable/exampleNested.vue +1 -1
  36. package/src/components/tables/mainTable/index.vue +7 -70
  37. package/src/components/tables/viewTable/index.vue +3 -3
  38. package/src/components/threeDots/index.vue +14 -8
  39. package/src/components/videoThumbnail/index.vue +95 -100
  40. package/src/main.js +4 -9
@@ -14,9 +14,11 @@
14
14
  labelFontColor || colorMode == 'dark' ? 'white' : 'eturnityGrey'
15
15
  "
16
16
  :fontSize="fontSize"
17
- >{{ label }} <optionalLabel v-if="labelOptional"> ({{ $gettext('Optional') }})</optionalLabel>
18
- </input-label
19
- >
17
+ >{{ label }}
18
+ <optionalLabel v-if="labelOptional">
19
+ ({{ $gettext('Optional') }})</optionalLabel
20
+ >
21
+ </input-label>
20
22
  <info-text
21
23
  v-if="infoTextMessage"
22
24
  :text="infoTextMessage"
@@ -129,7 +131,7 @@
129
131
  // </template>
130
132
  // </Select>
131
133
 
132
- import styled from 'vue-styled-components'
134
+ import styled from 'vue3-styled-components'
133
135
  import InfoText from '../../infoText'
134
136
  import icon from '../../icon'
135
137
  import inputText from '../inputText'
@@ -162,7 +164,6 @@ const InputLabel = styled('div', labelAttrs)`
162
164
  `
163
165
  const optionalLabel = styled.span`
164
166
  font-weight: 300;
165
-
166
167
  `
167
168
  const inputProps = { selectWidth: String, optionWidth: String }
168
169
  const Container = styled('div', inputProps)`
@@ -198,8 +199,7 @@ const selectButton = styled('div', selectButtonAttrs)`
198
199
  position: relative;
199
200
  box-sizing: border-box;
200
201
  border-radius: 4px;
201
- padding: ${(props) =>
202
- props.isSearchBarVisible ? '0' : '0px 0px 0 15px'};
202
+ padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
203
203
  text-align: left;
204
204
  border-radius: 4px;
205
205
  min-height: 36px;
@@ -427,9 +427,7 @@ export default {
427
427
  const optionElement = this.$el.querySelector(`[data-value="${e}"]`)
428
428
  if (this.$refs.dropdown) {
429
429
  this.hoveredIndex =
430
- this.$refs.dropdown.$children
431
- .map((component) => component.$el)
432
- .indexOf(optionElement) + 1
430
+ [...this.$refs.dropdown.$el.children].indexOf(optionElement) + 1
433
431
  }
434
432
  },
435
433
  mouseEnterHandler() {
@@ -446,15 +444,13 @@ export default {
446
444
  searchChange(value) {
447
445
  this.textSearch = value
448
446
  this.$emit('search-change', value)
449
- this.$refs.dropdown.$children
450
- .map((component) => component.$el)
451
- .forEach((el) => {
452
- if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
453
- el.style.display = 'none'
454
- } else {
455
- el.style.display = 'inherit'
456
- }
457
- })
447
+ ;[...this.$refs.dropdown.$el.children].forEach((el) => {
448
+ if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
449
+ el.style.display = 'none'
450
+ } else {
451
+ el.style.display = 'inherit'
452
+ }
453
+ })
458
454
  },
459
455
  onSelectSlotClick() {
460
456
  this.toggleDropdown()
@@ -476,10 +472,9 @@ export default {
476
472
  } else if (e.key == 'ArrowUp') {
477
473
  this.onArrowPress(-1)
478
474
  } else if (e.key == 'Enter') {
479
- const optionHoveredComponent =
480
- this.$refs.dropdown.$children[
481
- (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
482
- ]
475
+ const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
476
+ (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
477
+ ]
483
478
  this.optionSelected(optionHoveredComponent.$el.dataset.value)
484
479
  }
485
480
  },
@@ -488,10 +483,9 @@ export default {
488
483
  ((this.hoveredIndex + dir + this.optionLength - 1) %
489
484
  this.optionLength) +
490
485
  1
491
- const optionHoveredComponent =
492
- this.$refs.dropdown.$children[
493
- (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
494
- ]
486
+ const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
487
+ (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
488
+ ]
495
489
  const topPos = optionHoveredComponent.$el.offsetTop
496
490
  this.$refs.dropdown.$el.scrollTop = topPos
497
491
  }
@@ -499,7 +493,7 @@ export default {
499
493
  computed: {
500
494
  optionLength() {
501
495
  if (this.isDropdownOpen) {
502
- return this.$refs.dropdown.$children.length
496
+ return this.$refs.dropdown.$el.childElementCount
503
497
  } else {
504
498
  return 0
505
499
  }
@@ -7,7 +7,7 @@
7
7
  <script>
8
8
  // import selectButton from './selectButton'
9
9
  // import selectDropdown from './selectDropDown'
10
- import styled from 'vue-styled-components'
10
+ import styled from 'vue3-styled-components'
11
11
  const optionProps={hoveredBgColor:String}
12
12
  const optionContainer = styled('div',optionProps)`
13
13
  display:flex;
@@ -22,7 +22,7 @@
22
22
  // :maxValue="500" //default is 100 if not specified
23
23
  // />
24
24
  import Slider from "@vueform/slider/dist/slider.vue2.js"
25
- import styled from "vue-styled-components"
25
+ import styled from "vue3-styled-components"
26
26
 
27
27
  const Container = styled.div`
28
28
  margin: 16px 0 16px 21px;
@@ -73,7 +73,7 @@
73
73
  // :disabled="false"
74
74
  // />
75
75
 
76
- import styled from 'vue-styled-components'
76
+ import styled from 'vue3-styled-components'
77
77
  import InfoText from '../../infoText'
78
78
  import theme from '../../../assets/theme'
79
79
  const Container = styled.div``
@@ -51,7 +51,7 @@
51
51
  // :isDisabled="true"
52
52
  // . fontSize="13px"
53
53
  // />
54
- import styled from 'vue-styled-components'
54
+ import styled from 'vue3-styled-components'
55
55
  import InfoText from '../../infoText'
56
56
  import ErrorMessage from '../../errorMessage'
57
57
 
@@ -71,7 +71,7 @@
71
71
  // infoTextMessage="My info message"
72
72
  // />
73
73
 
74
- import styled from "vue-styled-components"
74
+ import styled from "vue3-styled-components"
75
75
  import InfoText from "../../infoText"
76
76
 
77
77
  const Container = styled.div`
@@ -28,7 +28,7 @@
28
28
  // <div>Data....</div>
29
29
  // </modal>
30
30
 
31
- import styled from 'vue-styled-components'
31
+ import styled from 'vue3-styled-components'
32
32
  import CloseButton from '../../buttons/closeButton'
33
33
  import Spinner from '../../spinner'
34
34
 
@@ -21,7 +21,7 @@
21
21
  // color="red"
22
22
  // infoText="My info text"
23
23
  // />
24
- import styled from "vue-styled-components"
24
+ import styled from "vue3-styled-components"
25
25
  import InfoText from "../infoText"
26
26
 
27
27
  const textAttrs = { color: String, hasInfoText: Boolean, marginBottom: String }
@@ -9,7 +9,7 @@
9
9
  // text="My Page Title"
10
10
  // color="red"
11
11
  // />
12
- import styled from "vue-styled-components"
12
+ import styled from "vue3-styled-components"
13
13
 
14
14
  const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
15
15
  const TitleText = styled("div", textAttrs)`
@@ -11,17 +11,17 @@
11
11
  </arrowIconContainer>
12
12
  <arrowText>{{ $gettext('back') }}</arrowText>
13
13
  </paginationLink>
14
-
14
+
15
15
  <!-- First page -->
16
16
  <paginationLink
17
17
  v-if="currentPage > 2 && paginationParams.pages > 3"
18
18
  @click="fetchPage(1)"
19
19
  >1</paginationLink
20
20
  >
21
-
21
+
22
22
  <!-- Back tree dots -->
23
23
  <span v-if="currentPage > 3 && paginationParams.pages > 4">...</span>
24
-
24
+
25
25
  <!-- Current block -->
26
26
  <paginationLink
27
27
  v-for="number in paginationNumbers()"
@@ -30,7 +30,7 @@
30
30
  @click="fetchPage(number)"
31
31
  >{{ number }}</paginationLink
32
32
  >
33
-
33
+
34
34
  <!-- Forward tree dots -->
35
35
  <span
36
36
  v-if="
@@ -38,7 +38,7 @@
38
38
  "
39
39
  >...</span
40
40
  >
41
-
41
+
42
42
  <!-- End page -->
43
43
  <paginationLink
44
44
  v-if="
@@ -47,7 +47,7 @@
47
47
  @click="fetchPage(paginationParams.pages)"
48
48
  >{{ paginationParams.pages }}</paginationLink
49
49
  >
50
-
50
+
51
51
  <!-- Forward button -->
52
52
  <paginationLink
53
53
  v-if="paginationParams.next"
@@ -60,11 +60,12 @@
60
60
  </paginationLink>
61
61
  </paginationWrapper>
62
62
  </template>
63
-
64
- <script>
65
- import styled from "vue-styled-components"
66
- import icon from "../icon"
67
- const paginationWrapper=styled.nav`
63
+
64
+ <script>
65
+ import styled from "vue3-styled-components"
66
+ import icon from "../icon"
67
+
68
+ const paginationWrapper=styled.nav`
68
69
  color: #1a237e;
69
70
  font-size: 13px;
70
71
  display: -webkit-box;
@@ -134,4 +135,3 @@ import styled from "vue-styled-components"
134
135
  }
135
136
  }
136
137
  </script>
137
-
@@ -31,7 +31,7 @@
31
31
  // stepNumber="4"
32
32
  // :labelText="translate('step')"
33
33
  // />
34
- import styled from "vue-styled-components"
34
+ import styled from "vue3-styled-components"
35
35
 
36
36
  const Container = styled.div`
37
37
  display: grid;
@@ -88,7 +88,7 @@
88
88
  // @deleteHandler="onMarkerDelete($event)"
89
89
  // />
90
90
 
91
- import styled from "vue-styled-components"
91
+ import styled from "vue3-styled-components"
92
92
  import Icon from "../icon"
93
93
  import Modal from '../modals/modal'
94
94
  import PageTitle from '../pageTitle'
@@ -18,7 +18,7 @@
18
18
  <script>
19
19
  // import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
20
20
  // <spinner size="30px" />
21
- import styled from 'vue-styled-components'
21
+ import styled from 'vue3-styled-components'
22
22
 
23
23
  const SpinnerContainer = styled.div`
24
24
  position: fixed;
@@ -104,7 +104,12 @@
104
104
  :src="require('../../assets/icons/collapse_arrow_icon.svg')"
105
105
  />
106
106
  </arrow-wrapper>
107
- <options-container v-if="isOpen" ref="optionsContainer">
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
@@ -181,10 +186,10 @@
181
186
  // :optionsDisplay="['display_name', 'company_item_number']" // Array. what should be displayed
182
187
  // :disabled="true"
183
188
  // />
184
- import styled from 'vue-styled-components'
185
- import Spinner from '@eturnity/eturnity_reusable_components/src/components/spinner'
186
- import SearchInput from '@eturnity/eturnity_reusable_components/src/components/inputs/searchInput'
187
- import InputText from '@eturnity/eturnity_reusable_components/src/components/inputs/inputText'
189
+ import styled from 'vue3-styled-components'
190
+ import Spinner from '@/components/spinner'
191
+ import SearchInput from '@/components/inputs/searchInput'
192
+ import InputText from '@/components/inputs/inputText'
188
193
 
189
194
  const rowAttrs = { disabled: Boolean, isOpen: Boolean }
190
195
  const DropdownRow = styled('div', rowAttrs)`
@@ -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
- left: 20px;
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(event) {
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
@@ -161,7 +161,7 @@
161
161
 
162
162
  <script>
163
163
  import draggable from "vuedraggable"
164
- import styled from "vue-styled-components"
164
+ import styled from "vue3-styled-components"
165
165
  import MainTable from "@/components/reusable-components/tables/MainTable"
166
166
  import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
167
167
  import DeleteIcon from "@/components/reusable-components/DeleteIcon"
@@ -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 />
@@ -29,18 +23,10 @@
29
23
  <script>
30
24
  // ToDo: add this to storybook
31
25
  // import MainTable from "@eturnity/eturnity_reusable_components/src/components/tables/mainTable"
32
- import styled from 'vue-styled-components'
26
+ import styled from 'vue3-styled-components'
33
27
  import Spinner from '../../spinner'
34
28
 
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
- `
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 tableScrollProps = {
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-x: auto;
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>
@@ -45,9 +45,9 @@
45
45
  // This is a read only table. Pass it data, and it displays it
46
46
  // ToDo: add this to storybook
47
47
  // import ViewTable from "@eturnity/eturnity_reusable_components/src/components/tables/viewTable"
48
- import styled from 'vue-styled-components'
49
- import DeleteIcon from '../../deleteIcon'
50
- import Spinner from '../../spinner'
48
+ import styled from "vue3-styled-components"
49
+ import DeleteIcon from "../../deleteIcon"
50
+ import Spinner from "../../spinner"
51
51
 
52
52
  const TableScroll = styled.div`
53
53
  position: relative;
@@ -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
  >
@@ -119,7 +121,7 @@
119
121
  // },
120
122
  // ],
121
123
 
122
- import styled from 'vue-styled-components'
124
+ import styled from 'vue3-styled-components'
123
125
  import Spinner from '../spinner'
124
126
 
125
127
  const PageContainer = styled.div`
@@ -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: 0;
167
- right: 27px;
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
  },