@dataloop-ai/components 0.16.8 → 0.16.10
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
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
<div
|
|
41
|
-
v-if="
|
|
41
|
+
v-if="progress"
|
|
42
42
|
class="kpi_box__progress_bar"
|
|
43
43
|
>
|
|
44
44
|
<dl-progress-bar
|
|
@@ -107,14 +107,9 @@ export default defineComponent({
|
|
|
107
107
|
},
|
|
108
108
|
progress: {
|
|
109
109
|
type: Object as PropType<DlKpiProgressType>,
|
|
110
|
-
default:
|
|
110
|
+
default: null
|
|
111
111
|
},
|
|
112
|
-
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: false,
|
|
115
|
-
required: false
|
|
116
|
-
},
|
|
117
|
-
withProgressBar: {
|
|
112
|
+
bordered: {
|
|
118
113
|
type: Boolean,
|
|
119
114
|
default: false,
|
|
120
115
|
required: false
|
|
@@ -127,6 +122,9 @@ export default defineComponent({
|
|
|
127
122
|
},
|
|
128
123
|
setup(props) {
|
|
129
124
|
const progressValue = (progress: DlKpiProgressType) => {
|
|
125
|
+
if (!progress) {
|
|
126
|
+
return null
|
|
127
|
+
}
|
|
130
128
|
return progress?.value ? progress.value / 100 : null
|
|
131
129
|
}
|
|
132
130
|
|
|
@@ -136,7 +134,7 @@ export default defineComponent({
|
|
|
136
134
|
|
|
137
135
|
const cssVars = computed(() => {
|
|
138
136
|
return {
|
|
139
|
-
'--dl-kpi-border': props.
|
|
137
|
+
'--dl-kpi-border': props.bordered ? '1px solid #e4e4e4' : '',
|
|
140
138
|
'--dl-kpi-title-max-width': isSingleWord(props.title)
|
|
141
139
|
? '100%'
|
|
142
140
|
: '90%', // todo: caused a bug with single words
|
|
@@ -32,6 +32,7 @@
|
|
|
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'
|
|
35
36
|
|
|
36
37
|
export default defineComponent({
|
|
37
38
|
name: 'DlIcon',
|
|
@@ -104,7 +105,12 @@ export default defineComponent({
|
|
|
104
105
|
},
|
|
105
106
|
methods: {
|
|
106
107
|
loadSvg() {
|
|
107
|
-
return new Promise<void>((resolve, reject) => {
|
|
108
|
+
return new Promise<void>(async (resolve, reject) => {
|
|
109
|
+
let dynamicalImagePath = null
|
|
110
|
+
await dynamicSvgImport(this.icon).then((path: any) => {
|
|
111
|
+
dynamicalImagePath = path
|
|
112
|
+
})
|
|
113
|
+
|
|
108
114
|
const svgElement = new Image()
|
|
109
115
|
svgElement.setAttribute('height', this.size)
|
|
110
116
|
svgElement.setAttribute('width', this.size)
|
|
@@ -128,7 +134,7 @@ export default defineComponent({
|
|
|
128
134
|
try {
|
|
129
135
|
svgElement.src = this.svgSource
|
|
130
136
|
? `${this.svgSource}/${this.icon}.svg`
|
|
131
|
-
:
|
|
137
|
+
: dynamicalImagePath
|
|
132
138
|
} catch (e) {
|
|
133
139
|
reject(e)
|
|
134
140
|
}
|