@eturnity/eturnity_reusable_components 7.18.0-qa-dev03.0 → 7.20.0--EPDM-10564.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/.storybook/preview.js +1 -1
- package/babel.config.js +2 -4
- package/package.json +18 -23
- package/src/App.vue +2 -2
- package/src/assets/svgIcons/split.svg +88 -6
- package/src/components/addNewButton/index.vue +5 -3
- package/src/components/buttons/buttonIcon/index.vue +1 -1
- package/src/components/buttons/closeButton/index.vue +1 -1
- package/src/components/buttons/mainButton/index.vue +6 -1
- package/src/components/card/index.vue +25 -24
- package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
- package/src/components/deleteIcon/index.vue +47 -30
- package/src/components/draggableInputHandle/index.vue +24 -25
- package/src/components/dropdown/index.vue +129 -110
- package/src/components/errorMessage/index.vue +10 -5
- package/src/components/filter/filterSettings.vue +59 -97
- package/src/components/filter/index.vue +3 -3
- package/src/components/filter/parentDropdown.vue +2 -2
- package/src/components/icon/iconCache.js +23 -0
- package/src/components/icon/iconCollection.vue +2 -2
- package/src/components/icon/index.vue +67 -75
- package/src/components/iconWrapper/index.vue +1 -4
- package/src/components/infoCard/index.vue +2 -3
- package/src/components/infoText/index.vue +2 -2
- package/src/components/inputs/checkbox/index.vue +21 -6
- package/src/components/inputs/inputNumber/index.vue +10 -10
- package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
- package/src/components/inputs/inputText/index.vue +3 -3
- package/src/components/inputs/radioButton/index.vue +1 -1
- package/src/components/inputs/searchInput/index.vue +28 -11
- package/src/components/inputs/select/index.vue +295 -67
- package/src/components/inputs/select/option/index.vue +49 -12
- package/src/components/inputs/slider/index.vue +16 -16
- package/src/components/inputs/switchField/index.vue +2 -2
- package/src/components/inputs/textAreaInput/index.vue +1 -1
- package/src/components/inputs/toggle/index.vue +2 -2
- package/src/components/label/index.vue +27 -31
- package/src/components/markerItem/index.vue +86 -0
- package/src/components/modals/modal/index.vue +2 -6
- package/src/components/navigationTabs/index.vue +27 -20
- package/src/components/pageSubtitle/index.vue +1 -1
- package/src/components/pageTitle/index.vue +13 -18
- package/src/components/pagination/index.vue +3 -3
- package/src/components/progressBar/index.vue +1 -1
- package/src/components/projectMarker/index.vue +16 -9
- package/src/components/sideMenu/index.vue +1 -1
- package/src/components/spinner/index.vue +7 -11
- package/src/components/tableDropdown/index.vue +35 -45
- package/src/components/tables/mainTable/exampleNested.vue +1 -1
- package/src/components/tables/mainTable/index.vue +10 -9
- package/src/components/tables/viewTable/index.vue +2 -2
- package/src/components/threeDots/index.vue +1 -1
- package/src/components/videoThumbnail/index.vue +95 -100
- package/src/main.js +4 -11
- package/src/assets/svgIcons/anchor.svg +0 -18
- package/src/assets/svgIcons/flatten_roof.svg +0 -20
@@ -1,7 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<page-container>
|
3
3
|
<marker-container
|
4
|
-
v-if="markerData"
|
4
|
+
v-if="markerData && markerData.translations[activeLanguage]"
|
5
5
|
:hasBorderRadius="hasBorderRadius"
|
6
6
|
:withDate="!!date"
|
7
7
|
:backgroundColor="markerData.color"
|
@@ -9,7 +9,7 @@
|
|
9
9
|
:isEditionAllowed="editionAllowed"
|
10
10
|
:isActive="activated"
|
11
11
|
:cursor="cursor"
|
12
|
-
@click
|
12
|
+
@click="editionAllowed ? (activated = !activated) : ''"
|
13
13
|
>
|
14
14
|
<icon
|
15
15
|
v-if="!!iconName"
|
@@ -18,7 +18,11 @@
|
|
18
18
|
size="10px"
|
19
19
|
:cursor="cursor"
|
20
20
|
/>
|
21
|
-
<span>{{
|
21
|
+
<span>{{
|
22
|
+
markerData.translations[activeLanguage]
|
23
|
+
? markerData.translations[activeLanguage].name
|
24
|
+
: '-'
|
25
|
+
}}</span>
|
22
26
|
<dot-wrapper v-if="editionAllowed" class="dotContainer">
|
23
27
|
<dot-icon />
|
24
28
|
<dot-icon />
|
@@ -28,11 +32,11 @@
|
|
28
32
|
v-if="activated"
|
29
33
|
v-click-outside="clickOutsideActionHandler"
|
30
34
|
>
|
31
|
-
<edit-item @click
|
35
|
+
<edit-item @click="deleteModalOpened = !deleteModalOpened">
|
32
36
|
<delete-icon />
|
33
37
|
<div>{{ $gettext('Delete') }}</div>
|
34
38
|
</edit-item>
|
35
|
-
<edit-item @click
|
39
|
+
<edit-item @click="onEditClick">
|
36
40
|
<icon-container>
|
37
41
|
<icon name="edit_button" size="14px" />
|
38
42
|
</icon-container>
|
@@ -52,10 +56,10 @@
|
|
52
56
|
<page-title :text="$gettext('delete_confirm_text')" />
|
53
57
|
<page-subtitle :text="$gettext('delete_confirm_subtext')" />
|
54
58
|
<cta-container>
|
55
|
-
<main-button @click
|
59
|
+
<main-button @click="onDelete" :text="$gettext('Delete')" />
|
56
60
|
<main-button
|
57
61
|
type="cancel"
|
58
|
-
@click
|
62
|
+
@click="closeDeleteModal"
|
59
63
|
:text="$gettext('Cancel')"
|
60
64
|
/>
|
61
65
|
</cta-container>
|
@@ -78,7 +82,8 @@
|
|
78
82
|
// @deleteHandler="onMarkerDelete($event)"
|
79
83
|
// />
|
80
84
|
|
81
|
-
import styled from '
|
85
|
+
import styled from 'vue3-styled-components'
|
86
|
+
import vClickOutside from 'click-outside-vue3'
|
82
87
|
import Icon from '../icon'
|
83
88
|
import Modal from '../modals/modal'
|
84
89
|
import PageTitle from '../pageTitle'
|
@@ -129,7 +134,6 @@ const MarkerContainer = styled('div', MarkerAttrs)`
|
|
129
134
|
props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
|
130
135
|
border-radius: ${(props) =>
|
131
136
|
props.hasBorderRadius ? (props.withDate ? '4px 0 0 4px' : '4px') : '0'};
|
132
|
-
|
133
137
|
white-space: nowrap;
|
134
138
|
cursor: ${(props) => (props.isEditionAllowed ? 'pointer' : props.cursor)};
|
135
139
|
|
@@ -196,6 +200,9 @@ const Date = styled.div`
|
|
196
200
|
|
197
201
|
export default {
|
198
202
|
name: 'project-marker',
|
203
|
+
directives: {
|
204
|
+
clickOutside: vClickOutside.directive
|
205
|
+
},
|
199
206
|
components: {
|
200
207
|
PageContainer,
|
201
208
|
MarkerContainer,
|
@@ -1,24 +1,19 @@
|
|
1
1
|
<template>
|
2
2
|
<spinner-container v-if="fullWidth">
|
3
3
|
<container>
|
4
|
-
<spinner-wrapper
|
5
|
-
:size="size"
|
6
|
-
:src="require('../../assets/icons/black_spinner.svg')"
|
7
|
-
/>
|
4
|
+
<spinner-wrapper :size="size" />
|
8
5
|
</container>
|
9
6
|
</spinner-container>
|
10
7
|
<container v-else :limitedToModal="limitedToModal">
|
11
|
-
<spinner-wrapper
|
12
|
-
:size="size"
|
13
|
-
:src="require('../../assets/icons/black_spinner.svg')"
|
14
|
-
/>
|
8
|
+
<spinner-wrapper :size="size" />
|
15
9
|
</container>
|
16
10
|
</template>
|
17
11
|
|
18
12
|
<script>
|
19
13
|
// import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
20
14
|
// <spinner size="30px" />
|
21
|
-
import styled from '
|
15
|
+
import styled from 'vue3-styled-components'
|
16
|
+
import SpinnerSvg from '../../assets/icons/black_spinner.svg?component'
|
22
17
|
|
23
18
|
const SpinnerContainer = styled.div`
|
24
19
|
position: fixed;
|
@@ -43,8 +38,9 @@ const Container = styled('div', containerAttrs)`
|
|
43
38
|
`
|
44
39
|
|
45
40
|
const spinnerAttrs = { size: String }
|
46
|
-
const SpinnerWrapper = styled(
|
41
|
+
const SpinnerWrapper = styled(SpinnerSvg, spinnerAttrs)`
|
47
42
|
width: ${(props) => (props.size ? props.size : '60px')};
|
43
|
+
height: auto;
|
48
44
|
`
|
49
45
|
|
50
46
|
export default {
|
@@ -69,4 +65,4 @@ export default {
|
|
69
65
|
}
|
70
66
|
}
|
71
67
|
}
|
72
|
-
</script>
|
68
|
+
</script>
|
@@ -40,12 +40,7 @@
|
|
40
40
|
"
|
41
41
|
@click.stop="onSelectedTemplateClick(item.row)"
|
42
42
|
>
|
43
|
-
<img
|
44
|
-
:src="require('../../assets/icons/file_icon.png')"
|
45
|
-
alt="icon"
|
46
|
-
width="12"
|
47
|
-
height="16"
|
48
|
-
/>
|
43
|
+
<img :src="fileIcon" alt="icon" width="12" height="16" />
|
49
44
|
<div>{{ item.value }}</div>
|
50
45
|
</template-link>
|
51
46
|
<no-template v-if="item.type && item.type === 'no-template'">
|
@@ -53,7 +48,7 @@
|
|
53
48
|
</no-template>
|
54
49
|
<input-container
|
55
50
|
v-if="item.type === 'input'"
|
56
|
-
@click.
|
51
|
+
@click.stop="onInputClick()"
|
57
52
|
>
|
58
53
|
<text-container
|
59
54
|
v-if="customInputDisabled"
|
@@ -93,16 +88,11 @@
|
|
93
88
|
triggerType="hover"
|
94
89
|
></et-popover>
|
95
90
|
<arrow-down
|
96
|
-
@click.
|
91
|
+
@click.stop="toggleOpen"
|
97
92
|
v-if="!isOpen"
|
98
93
|
class="arrow-dropdown"
|
99
|
-
:src="require('../../assets/icons/collapse_arrow_icon.svg')"
|
100
|
-
/>
|
101
|
-
<arrow-up
|
102
|
-
@click.native.stop="toggleOpen"
|
103
|
-
v-else
|
104
|
-
:src="require('../../assets/icons/collapse_arrow_icon.svg')"
|
105
94
|
/>
|
95
|
+
<arrow-up @click.stop="toggleOpen" v-else />
|
106
96
|
</arrow-wrapper>
|
107
97
|
<options-container v-if="isOpen" ref="optionsContainer">
|
108
98
|
<options-wrapper @click.prevent.stop>
|
@@ -127,20 +117,18 @@
|
|
127
117
|
:key="index"
|
128
118
|
@click="onItemClick(item)"
|
129
119
|
:tabindex="0"
|
130
|
-
@keyup.enter
|
120
|
+
@keyup.enter="onItemClick(item)"
|
131
121
|
>
|
132
|
-
<template v-for="(option, idx) in optionsDisplay">
|
133
|
-
<span v-if="option !== 'template'"
|
122
|
+
<template v-for="(option, idx) in optionsDisplay" :key="idx">
|
123
|
+
<span v-if="option !== 'template'">
|
134
124
|
{{ !!item[option] ? item[option] : '-' }}
|
135
125
|
</span>
|
136
126
|
<template-button
|
137
|
-
:key="idx"
|
138
127
|
@click.stop="onTemplateClick(item)"
|
139
128
|
v-else-if="option === 'template' && item.has_template"
|
140
129
|
>{{ $gettext('Use template...') }}</template-button
|
141
130
|
>
|
142
131
|
<no-template
|
143
|
-
:key="idx"
|
144
132
|
v-else-if="option === 'template' && !item.has_template"
|
145
133
|
>
|
146
134
|
{{ $gettext('No main component template') }}
|
@@ -183,10 +171,13 @@
|
|
183
171
|
// :optionsDisplay="['display_name', 'company_item_number']" // Array. what should be displayed
|
184
172
|
// :disabled="true"
|
185
173
|
// />
|
186
|
-
import styled from '
|
187
|
-
import Spinner from '
|
188
|
-
import SearchInput from '
|
189
|
-
import InputText from '
|
174
|
+
import styled from 'vue3-styled-components'
|
175
|
+
import Spinner from '../spinner'
|
176
|
+
import SearchInput from '../inputs/searchInput'
|
177
|
+
import InputText from '../inputs/inputText'
|
178
|
+
import CollapseArrowIcon from '../../assets/icons/collapse_arrow_icon.svg'
|
179
|
+
import SubpositionMarkerIcon from '../../assets/icons/subposition_marker.svg'
|
180
|
+
import fileIconPng from '../../assets/icons/file_icon.png'
|
190
181
|
|
191
182
|
const rowAttrs = { disabled: Boolean, isOpen: Boolean }
|
192
183
|
const DropdownRow = styled('div', rowAttrs)`
|
@@ -237,9 +228,8 @@ const ComponentContainer = styled('div', containerAttrs)`
|
|
237
228
|
padding: 5px 4px;
|
238
229
|
`
|
239
230
|
|
240
|
-
const ArrowDown = styled
|
231
|
+
const ArrowDown = styled(CollapseArrowIcon)`
|
241
232
|
width: 8px;
|
242
|
-
transform: rotate(0deg);
|
243
233
|
transition: transform 150ms ease;
|
244
234
|
`
|
245
235
|
|
@@ -403,9 +393,7 @@ const TextContainer = styled.div`
|
|
403
393
|
align-items: center;
|
404
394
|
`
|
405
395
|
|
406
|
-
const NestedIcon = styled
|
407
|
-
background-image: ${() =>
|
408
|
-
`url(${require('../../assets/icons/subposition_marker.svg')})`};
|
396
|
+
const NestedIcon = styled(SubpositionMarkerIcon)`
|
409
397
|
height: 10px;
|
410
398
|
width: 6px;
|
411
399
|
`
|
@@ -502,7 +490,8 @@ export default {
|
|
502
490
|
inputText: '',
|
503
491
|
wasClicked: false, // prevents custom-name from being triggered on the <input-text />
|
504
492
|
dynamicWidth: [], // for numbers
|
505
|
-
dynamicGridWidth: [] // for grid values
|
493
|
+
dynamicGridWidth: [], // for grid values
|
494
|
+
fileIcon: fileIconPng
|
506
495
|
}
|
507
496
|
},
|
508
497
|
methods: {
|
@@ -524,7 +513,7 @@ export default {
|
|
524
513
|
})
|
525
514
|
this.$emit('toggle-dropdown-open', { close: false })
|
526
515
|
this.$nextTick(() => {
|
527
|
-
this.$refs.searchInput.$el.children[0].children[
|
516
|
+
this.$refs.searchInput.$el.children[0].children[1].focus()
|
528
517
|
})
|
529
518
|
} else {
|
530
519
|
document.removeEventListener('click', this.clickOutside)
|
@@ -583,30 +572,28 @@ export default {
|
|
583
572
|
},
|
584
573
|
setDropdownWidth(options) {
|
585
574
|
this.dynamicWidth = []
|
586
|
-
|
587
|
-
|
575
|
+
|
576
|
+
options.forEach((item) => {
|
577
|
+
this.optionsDisplay.forEach((header, index) => {
|
588
578
|
let value =
|
589
579
|
header === 'template'
|
590
580
|
? this.$gettext('No main component template')
|
591
581
|
: item[header]
|
592
|
-
|
593
582
|
value = value ? value : ''
|
594
583
|
|
584
|
+
// Update dynamicWidth with the maximum value
|
595
585
|
if (
|
596
|
-
this.
|
597
|
-
|
598
|
-
value.length > this.dynamicWidth[index])
|
586
|
+
!this.dynamicWidth[index] ||
|
587
|
+
value.length > this.dynamicWidth[index]
|
599
588
|
) {
|
600
|
-
if (Array.isArray(this.dynamicGridWidth)) {
|
601
|
-
this.dynamicGridWidth[index] = value.length + 'ch'
|
602
|
-
}
|
603
589
|
this.dynamicWidth[index] = value.length
|
604
590
|
}
|
605
591
|
})
|
606
592
|
})
|
607
|
-
|
608
|
-
|
609
|
-
|
593
|
+
|
594
|
+
this.dynamicGridWidth = this.dynamicWidth
|
595
|
+
.map((width) => width + 'ch')
|
596
|
+
.join(' ')
|
610
597
|
}
|
611
598
|
},
|
612
599
|
computed: {
|
@@ -627,9 +614,12 @@ export default {
|
|
627
614
|
})
|
628
615
|
}
|
629
616
|
},
|
630
|
-
optionItems
|
631
|
-
|
632
|
-
|
617
|
+
optionItems: {
|
618
|
+
immediate: true,
|
619
|
+
handler(val) {
|
620
|
+
if (val && val.length) {
|
621
|
+
this.setDropdownWidth(val)
|
622
|
+
}
|
633
623
|
}
|
634
624
|
}
|
635
625
|
}
|
@@ -161,7 +161,7 @@
|
|
161
161
|
|
162
162
|
<script>
|
163
163
|
import draggable from "vuedraggable"
|
164
|
-
import styled from "
|
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"
|
@@ -29,8 +29,12 @@
|
|
29
29
|
<script>
|
30
30
|
// ToDo: add this to storybook
|
31
31
|
// import MainTable from "@eturnity/eturnity_reusable_components/src/components/tables/mainTable"
|
32
|
-
import styled from '
|
32
|
+
import styled from 'vue3-styled-components'
|
33
33
|
import Spinner from '../../spinner'
|
34
|
+
import dragIconSvg from '../../../assets/icons/drag_icon.svg?url'
|
35
|
+
import subpositionIconSvg from '../../../assets/icons/subposition_icon.svg?url'
|
36
|
+
import arrowDownSvg from '../../../assets/icons/arrow_down.svg?url'
|
37
|
+
import arrowUpRedSvg from '../../../assets/icons/arrow_up_red.svg?url'
|
34
38
|
|
35
39
|
const pageContainerProps = {
|
36
40
|
tableHeight: String,
|
@@ -122,6 +126,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
122
126
|
background-color: ${(props) => props.theme.colors.white};
|
123
127
|
cursor: ${(props) => (props.tableCursor ? props.tableCursor : 'auto')};
|
124
128
|
|
129
|
+
.select-button,
|
125
130
|
.arrow-container,
|
126
131
|
.input-placeholder,
|
127
132
|
.table-dropdown-item {
|
@@ -322,8 +327,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
322
327
|
height: 16px;
|
323
328
|
cursor: grab;
|
324
329
|
background-position: center;
|
325
|
-
background-image: ${() =>
|
326
|
-
`url(${require('../../../assets/icons/drag_icon.svg')})`};
|
330
|
+
background-image: ${() => `url(${dragIconSvg})`};
|
327
331
|
|
328
332
|
&:active {
|
329
333
|
cursor: grabbing;
|
@@ -335,8 +339,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
335
339
|
height: 11px;
|
336
340
|
background: no-repeat;
|
337
341
|
margin-left: 10px;
|
338
|
-
background-image: ${() =>
|
339
|
-
`url(${require('../../../assets/icons/subposition_icon.svg')})`};
|
342
|
+
background-image: ${() => `url(${subpositionIconSvg})`};
|
340
343
|
}
|
341
344
|
|
342
345
|
.arrow-down {
|
@@ -344,8 +347,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
344
347
|
height: 11px;
|
345
348
|
background: no-repeat;
|
346
349
|
background-position: center;
|
347
|
-
background-image: ${() =>
|
348
|
-
`url(${require('../../../assets/icons/arrow_down.svg')})`};
|
350
|
+
background-image: ${() => `url(${arrowDownSvg})`};
|
349
351
|
}
|
350
352
|
|
351
353
|
.arrow-up {
|
@@ -353,8 +355,7 @@ const TableContainer = styled('table', containerAttrs)`
|
|
353
355
|
height: 11px;
|
354
356
|
background: no-repeat;
|
355
357
|
background-position: center;
|
356
|
-
background-image: ${() =>
|
357
|
-
`url(${require('../../../assets/icons/arrow_up_red.svg')})`};
|
358
|
+
background-image: ${() => `url(${arrowUpRedSvg})`};
|
358
359
|
}
|
359
360
|
}
|
360
361
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
</table-item>
|
30
30
|
<icons-container v-if="showIconsContainer">
|
31
31
|
<delete-icon
|
32
|
-
@click
|
32
|
+
@click="$emit('on-click-delete', index)"
|
33
33
|
color="gray"
|
34
34
|
/>
|
35
35
|
</icons-container>
|
@@ -45,7 +45,7 @@
|
|
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 '
|
48
|
+
import styled from 'vue3-styled-components'
|
49
49
|
import DeleteIcon from '../../deleteIcon'
|
50
50
|
import Spinner from '../../spinner'
|
51
51
|
|
@@ -1,108 +1,103 @@
|
|
1
1
|
<template>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
// />
|
23
|
-
|
24
|
-
import styled from 'vue-styled-components'
|
25
|
-
import Icon from '../icon'
|
26
|
-
|
27
|
-
const wrapperAttrs = { width: String, height:String,fit:String }
|
28
|
-
const Wrapper = styled('div', wrapperAttrs)`
|
29
|
-
display: inline-block;
|
30
|
-
position: relative;
|
31
|
-
width:${props=>props.width};
|
32
|
-
height:${props=>props.height};
|
33
|
-
& img{
|
34
|
-
object-fit:${props=>props.fit};
|
35
|
-
width:${props=>props.width};
|
36
|
-
height:${props=>props.height};
|
37
|
-
}
|
38
|
-
`
|
39
|
-
const iconWrapper = styled('div')`
|
40
|
-
position: absolute;
|
41
|
-
top:0;
|
42
|
-
bottom:0;
|
43
|
-
left:0;
|
44
|
-
right:0;
|
45
|
-
display:flex;
|
46
|
-
justify-content:center;
|
47
|
-
align-items: center;
|
48
|
-
`
|
2
|
+
<wrapper :width="width" :height="height" :fit="fit">
|
3
|
+
<img :src="src" />
|
4
|
+
<iconWrapper>
|
5
|
+
<icon name="play" :size="playIconSize" :color="playIconColor" />
|
6
|
+
</iconWrapper>
|
7
|
+
</wrapper>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
// import VideoThumbnail from "@eturnity/eturnity_reusable_components/src/components/videoThumbnail"
|
12
|
+
// How to use:
|
13
|
+
//<videoThumbnail src="https://musicart.xboxlive.com/6/cfaf1e9d-0000-0000-0000-000000000009/504/image.jpg?w=1920&h=1080"
|
14
|
+
// playIconColor="red"
|
15
|
+
// playIconSize="20px"
|
16
|
+
// width="400px"
|
17
|
+
// height="600px"
|
18
|
+
// />
|
19
|
+
|
20
|
+
import styled from 'vue3-styled-components'
|
21
|
+
import Icon from '../icon'
|
49
22
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
23
|
+
const wrapperAttrs = { width: String, height: String, fit: String }
|
24
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
25
|
+
display: inline-block;
|
26
|
+
position: relative;
|
27
|
+
width: ${(props) => props.width};
|
28
|
+
height: ${(props) => props.height};
|
29
|
+
& img {
|
30
|
+
object-fit: ${(props) => props.fit};
|
31
|
+
width: ${(props) => props.width};
|
32
|
+
height: ${(props) => props.height};
|
33
|
+
}
|
34
|
+
`
|
35
|
+
const iconWrapper = styled('div')`
|
36
|
+
position: absolute;
|
37
|
+
top: 0;
|
38
|
+
bottom: 0;
|
39
|
+
left: 0;
|
40
|
+
right: 0;
|
41
|
+
display: flex;
|
42
|
+
justify-content: center;
|
43
|
+
align-items: center;
|
44
|
+
`
|
45
|
+
|
46
|
+
export default {
|
47
|
+
name: 'VideoThumbnail',
|
48
|
+
components: {
|
49
|
+
Wrapper,
|
50
|
+
Icon,
|
51
|
+
iconWrapper
|
52
|
+
},
|
53
|
+
props: {
|
54
|
+
src: {
|
55
|
+
required: true
|
56
56
|
},
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
},
|
61
|
-
fit:{
|
62
|
-
required: false,
|
63
|
-
default: 'cover'
|
64
|
-
},
|
65
|
-
width: {
|
66
|
-
required: false,
|
67
|
-
default: '300px'
|
68
|
-
},
|
69
|
-
height: {
|
70
|
-
required: false,
|
71
|
-
default: '200px'
|
72
|
-
},
|
73
|
-
playIconSize:{
|
74
|
-
required: false,
|
75
|
-
default: '50px'
|
76
|
-
},
|
77
|
-
playIconColor:{
|
78
|
-
required: false,
|
79
|
-
default: 'blue'
|
80
|
-
}
|
57
|
+
fit: {
|
58
|
+
required: false,
|
59
|
+
default: 'cover'
|
81
60
|
},
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
}
|
61
|
+
width: {
|
62
|
+
required: false,
|
63
|
+
default: '300px'
|
86
64
|
},
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
if (
|
91
|
-
this.$refs.dropdown.$el == event.target ||
|
92
|
-
this.$refs.dropdown.$el.contains(event.target)
|
93
|
-
) {
|
94
|
-
return
|
95
|
-
} else {
|
96
|
-
this.isOpenByClick=false
|
97
|
-
}
|
98
|
-
},
|
65
|
+
height: {
|
66
|
+
required: false,
|
67
|
+
default: '200px'
|
99
68
|
},
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
beforeDestroy() {
|
104
|
-
document.removeEventListener('click', this.clickOutside)
|
69
|
+
playIconSize: {
|
70
|
+
required: false,
|
71
|
+
default: '50px'
|
105
72
|
},
|
73
|
+
playIconColor: {
|
74
|
+
required: false,
|
75
|
+
default: 'blue'
|
76
|
+
}
|
77
|
+
},
|
78
|
+
data() {
|
79
|
+
return {
|
80
|
+
isOpenByClick: false
|
81
|
+
}
|
82
|
+
},
|
83
|
+
methods: {
|
84
|
+
clickOutside(event) {
|
85
|
+
if (this.openingMode != 'click') return
|
86
|
+
if (
|
87
|
+
this.$refs.dropdown.$el == event.target ||
|
88
|
+
this.$refs.dropdown.$el.contains(event.target)
|
89
|
+
) {
|
90
|
+
return
|
91
|
+
} else {
|
92
|
+
this.isOpenByClick = false
|
93
|
+
}
|
94
|
+
}
|
95
|
+
},
|
96
|
+
mounted() {
|
97
|
+
document.addEventListener('click', this.clickOutside)
|
98
|
+
},
|
99
|
+
beforeDestroy() {
|
100
|
+
document.removeEventListener('click', this.clickOutside)
|
106
101
|
}
|
107
|
-
|
108
|
-
|
102
|
+
}
|
103
|
+
</script>
|
package/src/main.js
CHANGED
@@ -1,13 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import VueCompositionAPI from "@vue/composition-api"
|
4
|
-
import vClickOutside from 'v-click-outside'
|
1
|
+
import App from './App.vue'
|
2
|
+
import { createApp } from 'vue'
|
5
3
|
|
6
|
-
|
4
|
+
const app = createApp(App)
|
7
5
|
|
8
|
-
|
9
|
-
Vue.use(vClickOutside)
|
10
|
-
|
11
|
-
new Vue({
|
12
|
-
render: (h) => h(App),
|
13
|
-
}).$mount("#app")
|
6
|
+
app.mount('#app')
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
3
|
-
<svg height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
4
|
-
viewBox="0 0 204.851 204.851" xml:space="preserve">
|
5
|
-
<g>
|
6
|
-
<g>
|
7
|
-
<g>
|
8
|
-
<path fill="white" d="M139.518,128.595l16.834,16.336c0,0-20.644,29.877-42.725,30.473
|
9
|
-
c0.479,0,0.117-84.092,0.039-104.472c14.694-4.797,25.402-18.182,25.402-34.117c0-20.009-16.697-36.218-37.273-36.218
|
10
|
-
c-20.615,0-37.312,16.209-37.312,36.208c0,15.671,10.376,28.929,24.748,33.961l0.098,104.277
|
11
|
-
c-26.643-1.837-42.061-27.474-42.061-27.474l17.997-17.41L0,120.505l9.887,63.301l17.362-16.795
|
12
|
-
c15.036,12.105,32.017,37.244,72.876,37.244c51.332-1.309,63.184-28.939,76.344-39.804l18.993,18.514l9.389-63.907
|
13
|
-
L139.518,128.595z M82.558,36.208c0-10.298,8.608-18.661,19.218-18.661s19.257,8.363,19.257,18.661
|
14
|
-
c0,10.327-8.647,18.681-19.257,18.681S82.558,46.535,82.558,36.208z"/>
|
15
|
-
</g>
|
16
|
-
</g>
|
17
|
-
</g>
|
18
|
-
</svg>
|