@eturnity/eturnity_reusable_components 9.19.7 → 9.19.9
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
|
@@ -250,7 +250,12 @@
|
|
|
250
250
|
const icon = reactive({ html: '' })
|
|
251
251
|
|
|
252
252
|
const loadSvg = async () => {
|
|
253
|
-
|
|
253
|
+
const raw = props.name
|
|
254
|
+
if (raw == null || String(raw).trim() === '') {
|
|
255
|
+
icon.html = ''
|
|
256
|
+
return
|
|
257
|
+
}
|
|
258
|
+
let svgString = await fetchIcon(String(raw).toLowerCase())
|
|
254
259
|
if (props.svgRotation) svgString = rotateSvg(svgString, props.svgRotation)
|
|
255
260
|
icon.html = svgString
|
|
256
261
|
}
|
|
@@ -1,23 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load SVG icon markup by file stem (lowercase), matching files in
|
|
3
|
+
* `src/assets/svgIcons/<stem>.svg`.
|
|
4
|
+
*
|
|
5
|
+
* Uses `import.meta.glob` instead of `new URL(..., import.meta.url)` + `fetch`
|
|
6
|
+
* so Vite does not emit a broken asset URL when this package is linked via
|
|
7
|
+
* `@fs/...` (which previously produced requests like `.../icon/undefined`).
|
|
8
|
+
*/
|
|
9
|
+
const rawIconModules = import.meta.glob('../../assets/svgIcons/*.svg', {
|
|
10
|
+
query: '?raw',
|
|
11
|
+
import: 'default',
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const iconLoadersByStem = {}
|
|
15
|
+
for (const path of Object.keys(rawIconModules)) {
|
|
16
|
+
const normalized = path.replace(/\\/g, '/')
|
|
17
|
+
const match = normalized.match(/\/([^/]+)\.svg$/i)
|
|
18
|
+
if (!match) continue
|
|
19
|
+
iconLoadersByStem[match[1].toLowerCase()] = rawIconModules[path]
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
const iconCache = {}
|
|
2
23
|
|
|
3
24
|
export const fetchIcon = async (fileName) => {
|
|
4
|
-
if (
|
|
5
|
-
|
|
25
|
+
if (fileName == null) {
|
|
26
|
+
console.warn('fetchIcon called with null or undefined fileName')
|
|
27
|
+
return ''
|
|
6
28
|
}
|
|
7
29
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
).href
|
|
30
|
+
const stem = String(fileName).trim().toLowerCase()
|
|
31
|
+
if (!stem) {
|
|
32
|
+
return ''
|
|
33
|
+
}
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
if (iconCache[stem]) {
|
|
36
|
+
return iconCache[stem]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const loader = iconLoadersByStem[stem]
|
|
40
|
+
if (!loader) {
|
|
41
|
+
console.error(`Unknown icon SVG: ${stem}.svg`)
|
|
42
|
+
return ''
|
|
43
|
+
}
|
|
18
44
|
|
|
45
|
+
try {
|
|
46
|
+
const rawFile = await loader()
|
|
47
|
+
iconCache[stem] = rawFile
|
|
19
48
|
return rawFile
|
|
20
49
|
} catch (error) {
|
|
21
|
-
console.error(`Failed to load ${
|
|
50
|
+
console.error(`Failed to load ${stem}.svg`, error)
|
|
51
|
+
return ''
|
|
22
52
|
}
|
|
23
53
|
}
|
|
@@ -49,45 +49,46 @@
|
|
|
49
49
|
@on-dropdown-close="onResponsibleSelectDropdownClose"
|
|
50
50
|
@on-dropdown-open="onResponsibleSelectDropdownOpen"
|
|
51
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
|
-
item.full_name
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
52
|
+
<template #selector>
|
|
53
|
+
<ResponsibleSelectorRow>
|
|
54
|
+
<ResponsibleAvatar>{{
|
|
55
|
+
responsibleInitials
|
|
56
|
+
}}</ResponsibleAvatar>
|
|
57
|
+
<ResponsibleTextStack>
|
|
58
|
+
<ResponsibleRoleLabel>{{
|
|
59
|
+
$gettext('responsible')
|
|
60
|
+
}}</ResponsibleRoleLabel>
|
|
61
|
+
<ResponsibleNameLine
|
|
62
|
+
:title="responsibleDisplayName"
|
|
63
|
+
>{{ responsibleDisplayName }}</ResponsibleNameLine
|
|
64
|
+
>
|
|
65
|
+
</ResponsibleTextStack>
|
|
66
|
+
</ResponsibleSelectorRow>
|
|
67
|
+
</template>
|
|
68
|
+
<template #dropdown>
|
|
69
|
+
<SelectOption
|
|
70
|
+
v-for="(item, optionIdx) in projectManagerOptions"
|
|
71
|
+
:key="
|
|
72
|
+
item.id === null || item.id === undefined
|
|
73
|
+
? `pm_opt_none_${optionIdx}`
|
|
74
|
+
: `pm_opt_${item.id}`
|
|
75
|
+
"
|
|
76
|
+
:data-id="`sidebar_responsible_option_${optionIdx + 1}`"
|
|
77
|
+
:data-qa-id="`sidebar_responsible_option_${
|
|
78
|
+
optionIdx + 1
|
|
79
|
+
}`"
|
|
80
|
+
:value="item.id"
|
|
81
|
+
>
|
|
82
|
+
<ResponsibleOptionRow>
|
|
83
|
+
<ResponsibleOptionAvatar>{{
|
|
84
|
+
initialsFromFullName(item.full_name)
|
|
85
|
+
}}</ResponsibleOptionAvatar>
|
|
86
|
+
<SelectOptionText :title="item.full_name">{{
|
|
87
|
+
item.full_name
|
|
88
|
+
}}</SelectOptionText>
|
|
89
|
+
</ResponsibleOptionRow>
|
|
90
|
+
</SelectOption>
|
|
91
|
+
</template>
|
|
91
92
|
</SelectComponent>
|
|
92
93
|
</ResponsibleSelectSurface>
|
|
93
94
|
</ResponsibleCard>
|
|
@@ -141,6 +142,7 @@
|
|
|
141
142
|
>
|
|
142
143
|
<IconCell :is-collapsed="isCollapsed">
|
|
143
144
|
<IconComponent
|
|
145
|
+
v-if="item.icon"
|
|
144
146
|
:color="
|
|
145
147
|
item.id === activeItemId
|
|
146
148
|
? theme.semanticColors.purple[500]
|
|
@@ -186,6 +188,7 @@
|
|
|
186
188
|
>
|
|
187
189
|
<IconCell :is-collapsed="isCollapsed">
|
|
188
190
|
<IconComponent
|
|
191
|
+
v-if="item.icon"
|
|
189
192
|
:color="
|
|
190
193
|
item.id === activeParentId
|
|
191
194
|
? theme.semanticColors.purple[500]
|
|
@@ -595,7 +598,7 @@
|
|
|
595
598
|
align-items: center;
|
|
596
599
|
justify-content: center;
|
|
597
600
|
flex-shrink: 0;
|
|
598
|
-
margin-left: ${(p) => (p.isCollapsed ? '0' : '
|
|
601
|
+
margin-left: ${(p) => (p.isCollapsed ? '0' : 'auto')};
|
|
599
602
|
`
|
|
600
603
|
|
|
601
604
|
const ResponsibleBlock = styled.div`
|