@dataloop-ai/components 0.16.11 → 0.16.13
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
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
import { v4 } from 'uuid'
|
|
33
33
|
import { defineComponent } from 'vue-demi'
|
|
34
34
|
import { getColor, loggerFactory } from '../../../utils'
|
|
35
|
-
import { dynamicSvgImport } from '../../../utils/dynamicSvgImport'
|
|
36
35
|
|
|
37
36
|
export default defineComponent({
|
|
38
37
|
name: 'DlIcon',
|
|
@@ -105,12 +104,7 @@ export default defineComponent({
|
|
|
105
104
|
},
|
|
106
105
|
methods: {
|
|
107
106
|
loadSvg() {
|
|
108
|
-
return new Promise<void>(
|
|
109
|
-
let dynamicalImagePath = null
|
|
110
|
-
await dynamicSvgImport(this.icon).then((path: any) => {
|
|
111
|
-
dynamicalImagePath = path
|
|
112
|
-
})
|
|
113
|
-
|
|
107
|
+
return new Promise<void>((resolve, reject) => {
|
|
114
108
|
const svgElement = new Image()
|
|
115
109
|
svgElement.setAttribute('height', this.size)
|
|
116
110
|
svgElement.setAttribute('width', this.size)
|
|
@@ -134,7 +128,7 @@ export default defineComponent({
|
|
|
134
128
|
try {
|
|
135
129
|
svgElement.src = this.svgSource
|
|
136
130
|
? `${this.svgSource}/${this.icon}.svg`
|
|
137
|
-
:
|
|
131
|
+
: require(`@dataloop-ai/icons/assets/${this.icon}.svg`)
|
|
138
132
|
} catch (e) {
|
|
139
133
|
reject(e)
|
|
140
134
|
}
|
|
@@ -50,18 +50,28 @@ export default defineComponent({
|
|
|
50
50
|
fontWeight: this.bold ? 'bold' : 400
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if (!this.size) {
|
|
54
|
-
if (sizes.includes(this.variant)) {
|
|
55
|
-
styles.fontSize = this.variant as string
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
53
|
+
if (this.size && !sizes.includes(this.size)) {
|
|
58
54
|
styles.fontSize = this.size as string
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
return styles
|
|
62
58
|
},
|
|
63
59
|
classes(): string[] {
|
|
64
|
-
|
|
60
|
+
const classes = [`dl-typography`]
|
|
61
|
+
|
|
62
|
+
if (this.size) {
|
|
63
|
+
if (sizes.includes(this.size)) {
|
|
64
|
+
classes.push(`dl-typography--${this.size}`)
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (sizes.includes(this.variant)) {
|
|
68
|
+
classes.push(`dl-typography--${this.size}`)
|
|
69
|
+
} else {
|
|
70
|
+
classes.push(`dl-typography--body`)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return classes
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
77
|
})
|