@eturnity/eturnity_reusable_components 7.18.0-qa-dev03.0 → 7.20.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/.storybook/preview.js +1 -1
- package/package.json +19 -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 +1 -1
- 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 +244 -57
- package/src/components/inputs/select/option/index.vue +43 -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/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 +4 -4
- 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,119 +1,138 @@
|
|
1
1
|
<template>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
2
|
+
<wrapper ref="dropdown" :openingMode="openingMode">
|
3
|
+
<WrapperButton @click="isOpenByClick = !isOpenByClick">
|
4
|
+
<slot name="trigger" />
|
5
|
+
</WrapperButton>
|
6
|
+
<WrapperDropdown
|
7
|
+
class="dropdown-content"
|
8
|
+
:class="{ openDropdown: isOpenByClick && openingMode == 'click' }"
|
9
|
+
:justify="justify"
|
10
|
+
:position="position"
|
11
|
+
:width="width"
|
12
|
+
:backgroundColor="backgroundColor"
|
13
|
+
>
|
14
|
+
<DropdownWindow
|
15
|
+
:gap="gap"
|
16
|
+
:backgroundColor="backgroundColor"
|
17
|
+
:width="width"
|
18
|
+
>
|
19
|
+
<slot name="dropdown" />
|
20
|
+
</DropdownWindow>
|
21
|
+
</WrapperDropdown>
|
22
|
+
</wrapper>
|
23
|
+
</template>
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
display: inline-block;
|
28
|
-
position: relative;
|
25
|
+
<script>
|
26
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
27
|
+
// How to use:
|
28
|
+
//<DropdownComponent
|
29
|
+
// width="300px"
|
30
|
+
// backgroundColor="red">
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
backgroundColor: {
|
89
|
-
required: false,
|
90
|
-
default: 'white'
|
91
|
-
}
|
32
|
+
// <DropdownComponent/>
|
33
|
+
|
34
|
+
import styled from 'vue3-styled-components'
|
35
|
+
|
36
|
+
const wrapperAttrs = {
|
37
|
+
width: String,
|
38
|
+
backgroundColor: String,
|
39
|
+
openingMode: String,
|
40
|
+
gap: String,
|
41
|
+
justify: String
|
42
|
+
}
|
43
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
44
|
+
display: inline-block;
|
45
|
+
position: relative;
|
46
|
+
|
47
|
+
&:hover .dropdown-content {
|
48
|
+
${(props) => (props.openingMode == 'hover' ? 'display:block' : '')}
|
49
|
+
}
|
50
|
+
& .openDropdown {
|
51
|
+
${(props) =>
|
52
|
+
props.openingMode == 'click' ? 'display:block !important' : ''}
|
53
|
+
}
|
54
|
+
`
|
55
|
+
const WrapperDropdown = styled('div', wrapperAttrs)`
|
56
|
+
margin-top: 0;
|
57
|
+
display: none;
|
58
|
+
position: absolute;
|
59
|
+
z-index: 1;
|
60
|
+
${(props) => (props.justify == 'right' ? 'right:0;' : '')}
|
61
|
+
`
|
62
|
+
const DropdownWindow = styled('div', wrapperAttrs)`
|
63
|
+
width: ${(props) => props.width};
|
64
|
+
background-color: ${(props) =>
|
65
|
+
props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
66
|
+
margin-top: ${(props) => props.gap};
|
67
|
+
border-radius: 4px;
|
68
|
+
position: relative;
|
69
|
+
min-width: 160px;
|
70
|
+
box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.302);
|
71
|
+
z-index: 1;
|
72
|
+
`
|
73
|
+
|
74
|
+
const WrapperButton = styled('div', wrapperAttrs)`
|
75
|
+
display: inline-block;
|
76
|
+
`
|
77
|
+
|
78
|
+
export default {
|
79
|
+
name: 'DropdownComponent',
|
80
|
+
components: {
|
81
|
+
WrapperDropdown,
|
82
|
+
WrapperButton,
|
83
|
+
Wrapper,
|
84
|
+
DropdownWindow
|
85
|
+
},
|
86
|
+
props: {
|
87
|
+
width: {
|
88
|
+
required: false,
|
89
|
+
default: '300px'
|
92
90
|
},
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
91
|
+
gap: {
|
92
|
+
required: false,
|
93
|
+
default: '10px'
|
97
94
|
},
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if (
|
102
|
-
this.$refs.dropdown.$el == event.target ||
|
103
|
-
this.$refs.dropdown.$el.contains(event.target)
|
104
|
-
) {
|
105
|
-
return
|
106
|
-
} else {
|
107
|
-
this.isOpenByClick=false
|
108
|
-
}
|
109
|
-
},
|
95
|
+
position: {
|
96
|
+
required: false,
|
97
|
+
default: 'bottom'
|
110
98
|
},
|
111
|
-
|
112
|
-
|
99
|
+
justify: {
|
100
|
+
required: false,
|
101
|
+
default: 'left'
|
113
102
|
},
|
114
|
-
|
115
|
-
|
103
|
+
openingMode: {
|
104
|
+
required: false,
|
105
|
+
default: 'hover'
|
116
106
|
},
|
107
|
+
backgroundColor: {
|
108
|
+
required: false,
|
109
|
+
default: 'white'
|
110
|
+
}
|
111
|
+
},
|
112
|
+
data() {
|
113
|
+
return {
|
114
|
+
isOpenByClick: false
|
115
|
+
}
|
116
|
+
},
|
117
|
+
methods: {
|
118
|
+
clickOutside(event) {
|
119
|
+
if (this.openingMode != 'click') return
|
120
|
+
if (
|
121
|
+
this.$refs.dropdown &&
|
122
|
+
(this.$refs.dropdown.$el == event.target ||
|
123
|
+
this.$refs.dropdown.$el.contains(event.target))
|
124
|
+
) {
|
125
|
+
return
|
126
|
+
} else {
|
127
|
+
this.isOpenByClick = false
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
mounted() {
|
132
|
+
document.addEventListener('click', this.clickOutside)
|
133
|
+
},
|
134
|
+
beforeDestroy() {
|
135
|
+
document.removeEventListener('click', this.clickOutside)
|
117
136
|
}
|
118
|
-
|
119
|
-
|
137
|
+
}
|
138
|
+
</script>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<component-wrapper>
|
3
|
-
<text-overlay>
|
3
|
+
<text-overlay :marginTop="marginTop">
|
4
4
|
<slot></slot>
|
5
5
|
</text-overlay>
|
6
6
|
</component-wrapper>
|
@@ -11,11 +11,11 @@
|
|
11
11
|
//To use:
|
12
12
|
// <error-message />
|
13
13
|
|
14
|
-
import styled from '
|
14
|
+
import styled from 'vue3-styled-components'
|
15
15
|
|
16
|
-
const TextOverlay = styled
|
16
|
+
const TextOverlay = styled('div', { marginTop: String })`
|
17
17
|
position: absolute;
|
18
|
-
top: calc(100% +
|
18
|
+
top: calc(100% + ${(props) => props.marginTop});
|
19
19
|
background: ${(props) => props.theme.colors.red};
|
20
20
|
padding: 10px;
|
21
21
|
width: max-content;
|
@@ -50,7 +50,12 @@ export default {
|
|
50
50
|
TextOverlay,
|
51
51
|
ComponentWrapper
|
52
52
|
},
|
53
|
-
props: {
|
53
|
+
props: {
|
54
|
+
marginTop: {
|
55
|
+
required: false,
|
56
|
+
default: '13px'
|
57
|
+
}
|
58
|
+
},
|
54
59
|
methods: {},
|
55
60
|
data() {
|
56
61
|
return {}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<upper-container v-if="filterViews && filterViews.length">
|
4
4
|
<view-container :maxWidth="activeView.length">
|
5
5
|
<select-component
|
6
|
-
@click.
|
6
|
+
@click.stop
|
7
7
|
selectWidth="100%"
|
8
8
|
selectHeight="36px"
|
9
9
|
fontSize="13px"
|
@@ -19,10 +19,10 @@
|
|
19
19
|
<Option
|
20
20
|
v-for="(item, idx) in filterViews"
|
21
21
|
:key="idx + '_view'"
|
22
|
-
@click
|
22
|
+
@click="$emit('on-view-select', item)"
|
23
23
|
:value="item.name"
|
24
24
|
>{{ item.name }}
|
25
|
-
<delete-icon @click.
|
25
|
+
<delete-icon @click.stop="$emit('on-view-delete', item)"
|
26
26
|
/></Option>
|
27
27
|
</template>
|
28
28
|
</select-component>
|
@@ -55,28 +55,28 @@
|
|
55
55
|
ghost-class="ghost"
|
56
56
|
:setData="modifyDragItem"
|
57
57
|
v-model="item.dataOptions"
|
58
|
+
itemKey="choice"
|
58
59
|
>
|
59
|
-
<
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
</checkbox-wrapper>
|
60
|
+
<template #item="{ element: column }">
|
61
|
+
<checkbox-wrapper>
|
62
|
+
<drag-container class="drag-container">
|
63
|
+
<icon :name="'duplicate-1'" size="12px" />
|
64
|
+
</drag-container>
|
65
|
+
<checkbox
|
66
|
+
:label="column.text"
|
67
|
+
:isChecked="column.selected"
|
68
|
+
@on-event-handler="
|
69
|
+
onChange({
|
70
|
+
dataType: item.type,
|
71
|
+
value: $event,
|
72
|
+
choice: column.choice
|
73
|
+
})
|
74
|
+
"
|
75
|
+
size="small"
|
76
|
+
:isDisabled="column.selected && isCheckboxDisabled"
|
77
|
+
/>
|
78
|
+
</checkbox-wrapper>
|
79
|
+
</template>
|
80
80
|
</draggable>
|
81
81
|
</checkbox-container>
|
82
82
|
</row-container>
|
@@ -94,6 +94,7 @@
|
|
94
94
|
:labelDataId="filter.dataId"
|
95
95
|
alignItems="vertical"
|
96
96
|
:disabled="!filter.choices.length"
|
97
|
+
:minOptionLength="1"
|
97
98
|
>
|
98
99
|
<template #selector>
|
99
100
|
<option-title> {{ filter.selectedText }} </option-title>
|
@@ -169,12 +170,20 @@
|
|
169
170
|
>
|
170
171
|
<row-label :data-id="filter.dataId">{{ filter.label }}</row-label>
|
171
172
|
<grid-container>
|
172
|
-
<
|
173
|
+
<VueDatePicker
|
174
|
+
text-input
|
173
175
|
:placeholder="$gettext('Date from')"
|
174
|
-
:
|
175
|
-
|
176
|
-
:
|
177
|
-
|
176
|
+
:locale="getDatePickerLanguage()"
|
177
|
+
:model-value="filter.range.start"
|
178
|
+
:enable-time-picker="false"
|
179
|
+
:clearable="true"
|
180
|
+
:auto-apply="true"
|
181
|
+
:disabled-dates="disableFutureDates"
|
182
|
+
format="yyyy-MM-dd"
|
183
|
+
model-type="format"
|
184
|
+
@focus="onDatepickerFocus(filter.range)"
|
185
|
+
@close="onDatepickerBlur()"
|
186
|
+
@update:model-value="
|
178
187
|
onChange({
|
179
188
|
dataType: item.type,
|
180
189
|
value: $event,
|
@@ -182,18 +191,21 @@
|
|
182
191
|
field: filter.field
|
183
192
|
})
|
184
193
|
"
|
185
|
-
@focus="onDatepickerFocus(filter.range)"
|
186
|
-
@close="onDatepickerBlur()"
|
187
|
-
format="YYYY-MM-DD"
|
188
|
-
valueType="format"
|
189
|
-
:disabled-date="disableFutureDates"
|
190
194
|
/>
|
191
|
-
<
|
195
|
+
<VueDatePicker
|
196
|
+
text-input
|
192
197
|
:placeholder="$gettext('Date to')"
|
193
|
-
:
|
194
|
-
|
195
|
-
:
|
196
|
-
|
198
|
+
:locale="getDatePickerLanguage()"
|
199
|
+
:model-value="filter.range.end"
|
200
|
+
:enable-time-picker="false"
|
201
|
+
:clearable="true"
|
202
|
+
:auto-apply="true"
|
203
|
+
:disabled-dates="disablePastDates"
|
204
|
+
format="yyyy-MM-dd"
|
205
|
+
model-type="format"
|
206
|
+
@focus="onDatepickerFocus(filter.range)"
|
207
|
+
@close="onDatepickerBlur()"
|
208
|
+
@update:model-value="
|
197
209
|
onChange({
|
198
210
|
dataType: item.type,
|
199
211
|
value: $event,
|
@@ -201,11 +213,6 @@
|
|
201
213
|
field: filter.field
|
202
214
|
})
|
203
215
|
"
|
204
|
-
@focus="onDatepickerFocus(filter.range)"
|
205
|
-
@close="onDatepickerBlur()"
|
206
|
-
format="YYYY-MM-DD"
|
207
|
-
valueType="format"
|
208
|
-
:disabled-date="disablePastDates"
|
209
216
|
/>
|
210
217
|
</grid-container>
|
211
218
|
</section-container>
|
@@ -247,27 +254,26 @@
|
|
247
254
|
v-if="buttonText.apply_view"
|
248
255
|
type="primary"
|
249
256
|
:text="buttonText.apply_view"
|
250
|
-
@click
|
257
|
+
@click="$emit('on-apply-current-view')"
|
251
258
|
/>
|
252
259
|
<main-button
|
253
260
|
type="secondary"
|
254
261
|
v-if="buttonText.save_view"
|
255
262
|
:text="buttonText.save_view"
|
256
|
-
@click
|
263
|
+
@click="$emit('on-save-new-view')"
|
257
264
|
/>
|
258
265
|
<main-button
|
259
266
|
type="cancel"
|
260
267
|
v-if="buttonText.cancel"
|
261
268
|
:text="buttonText.cancel"
|
262
|
-
@click
|
269
|
+
@click="$emit('on-cancel-view')"
|
263
270
|
/>
|
264
271
|
</button-container>
|
265
272
|
</container-wrapper>
|
266
273
|
</template>
|
267
274
|
|
268
275
|
<script>
|
269
|
-
import styled from '
|
270
|
-
import DatePicker from 'vue2-datepicker'
|
276
|
+
import styled from 'vue3-styled-components'
|
271
277
|
import SelectComponent from '../inputs/select'
|
272
278
|
import Option from '../inputs/select/option'
|
273
279
|
import InputNumber from '../inputs/inputNumber'
|
@@ -278,12 +284,7 @@ import Icon from '../icon'
|
|
278
284
|
import DeleteIcon from '../deleteIcon'
|
279
285
|
import { datePickerLang } from '../../helpers/translateLang'
|
280
286
|
import theme from '@/assets/theme.js'
|
281
|
-
import '
|
282
|
-
import 'vue2-datepicker/locale/de'
|
283
|
-
import 'vue2-datepicker/locale/en'
|
284
|
-
import 'vue2-datepicker/locale/es'
|
285
|
-
import 'vue2-datepicker/locale/fr'
|
286
|
-
import 'vue2-datepicker/locale/it'
|
287
|
+
import VueDatePicker from '@vuepic/vue-datepicker'
|
287
288
|
|
288
289
|
const ContainerWrapper = styled.div`
|
289
290
|
position: absolute;
|
@@ -376,52 +377,13 @@ const DropdownCheckboxContainer = styled.div`
|
|
376
377
|
gap: 6px;
|
377
378
|
width: 100%;
|
378
379
|
padding: 12px 10px;
|
380
|
+
background: ${(props) => props.theme.colors.grey5};
|
379
381
|
`
|
380
382
|
|
381
383
|
const RowWrapper = styled.div`
|
382
384
|
margin-bottom: 12px;
|
383
385
|
`
|
384
386
|
|
385
|
-
const DatePickerInput = styled(DatePicker)`
|
386
|
-
border: 1px solid ${(props) => props.theme.colors.grey4};
|
387
|
-
border-radius: 4px;
|
388
|
-
padding: 7px 12px 7px 7px;
|
389
|
-
width: 100%;
|
390
|
-
position: relative;
|
391
|
-
|
392
|
-
&.mx-datepicker {
|
393
|
-
width: 100% !important;
|
394
|
-
max-width: 100%;
|
395
|
-
height: 36px;
|
396
|
-
align-self: flex-end;
|
397
|
-
}
|
398
|
-
|
399
|
-
.mx-input-wrapper {
|
400
|
-
position: unset;
|
401
|
-
|
402
|
-
input {
|
403
|
-
border: none;
|
404
|
-
height: auto;
|
405
|
-
padding: 0;
|
406
|
-
font-size: 13px;
|
407
|
-
box-shadow: none;
|
408
|
-
color: #393939;
|
409
|
-
vertical-align: bottom;
|
410
|
-
}
|
411
|
-
|
412
|
-
.mx-input-append {
|
413
|
-
top: 1px;
|
414
|
-
}
|
415
|
-
}
|
416
|
-
|
417
|
-
.mx-input-append {
|
418
|
-
left: 0;
|
419
|
-
top: 5px;
|
420
|
-
height: auto;
|
421
|
-
cursor: pointer;
|
422
|
-
}
|
423
|
-
`
|
424
|
-
|
425
387
|
const LabelAttrs = {
|
426
388
|
marginTop: Boolean
|
427
389
|
}
|
@@ -486,14 +448,14 @@ export default {
|
|
486
448
|
Icon,
|
487
449
|
DragContainer,
|
488
450
|
InputNumber,
|
489
|
-
DatePickerInput,
|
490
451
|
RowLabel,
|
491
452
|
SectionContainer,
|
492
453
|
GridContainer,
|
493
454
|
ViewContainer,
|
494
455
|
DeleteIcon,
|
495
456
|
UpperContainer,
|
496
|
-
ResetButton
|
457
|
+
ResetButton,
|
458
|
+
VueDatePicker
|
497
459
|
},
|
498
460
|
props: {
|
499
461
|
filterData: {
|
@@ -29,7 +29,7 @@
|
|
29
29
|
</template>
|
30
30
|
|
31
31
|
<script>
|
32
|
-
import styled from '
|
32
|
+
import styled from 'vue3-styled-components'
|
33
33
|
import parentDropdown from './parentDropdown'
|
34
34
|
import filterSettings from './filterSettings'
|
35
35
|
|
@@ -93,9 +93,9 @@ export default {
|
|
93
93
|
}, 100)
|
94
94
|
},
|
95
95
|
clickOutside(event) {
|
96
|
-
const target = event.target
|
97
96
|
if (
|
98
|
-
|
97
|
+
this.$refs.dropdown &&
|
98
|
+
!this.$refs.dropdown.$el.contains(event.target) &&
|
99
99
|
!this.preventOutsideClick
|
100
100
|
) {
|
101
101
|
this.isDropdownOpen = false
|
@@ -9,7 +9,7 @@
|
|
9
9
|
</title-text>
|
10
10
|
<arrow-wrapper>
|
11
11
|
<icon
|
12
|
-
@click.
|
12
|
+
@click.stop="$emit('on-toggle')"
|
13
13
|
:name="isOpen ? 'arrow_up' : 'arrow_down'"
|
14
14
|
size="12px"
|
15
15
|
/>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
</template>
|
20
20
|
|
21
21
|
<script>
|
22
|
-
import styled from '
|
22
|
+
import styled from 'vue3-styled-components'
|
23
23
|
import Icon from '../icon'
|
24
24
|
|
25
25
|
const PageWrapper = styled.div`
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const iconCache = {}
|
2
|
+
|
3
|
+
export const fetchIcon = async (fileName) => {
|
4
|
+
if (iconCache[fileName]) {
|
5
|
+
return iconCache[fileName]
|
6
|
+
}
|
7
|
+
|
8
|
+
// We need to use "new URL" to load dynamic assets (https://vitejs.dev/guide/assets.html#new-url-url-import-meta-url)
|
9
|
+
const fetchUrl = new URL(
|
10
|
+
`../../assets/svgIcons/${fileName}.svg`,
|
11
|
+
import.meta.url
|
12
|
+
).href
|
13
|
+
|
14
|
+
try {
|
15
|
+
const response = await fetch(fetchUrl)
|
16
|
+
const rawFile = await response.text()
|
17
|
+
iconCache[fileName] = rawFile
|
18
|
+
|
19
|
+
return rawFile
|
20
|
+
} catch (error) {
|
21
|
+
console.error(`Failed to load ${fileName}.svg`)
|
22
|
+
}
|
23
|
+
}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
<script>
|
18
18
|
import icon from './index.vue'
|
19
|
-
import styled from '
|
19
|
+
import styled from 'vue3-styled-components'
|
20
20
|
|
21
21
|
const Wrapper = styled.div`
|
22
22
|
display: block;
|
@@ -36,7 +36,7 @@ const IconWrapper = styled.div`
|
|
36
36
|
margin: 10px;
|
37
37
|
`
|
38
38
|
export default {
|
39
|
-
name: '
|
39
|
+
name: 'collectionComponent',
|
40
40
|
components: { icon, IconWrapper, Wrapper },
|
41
41
|
props: {
|
42
42
|
size: { required: false },
|