@dataloop-ai/components 0.16.6 → 0.16.7
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 +1 -1
- package/src/components/basic/DlKpi/DlKpi.vue +17 -9
- package/src/components/compound/DlCounters/DlCounters.vue +9 -2
- package/src/components/compound/DlItem/index.ts +1 -1
- package/src/components/essential/DlTypography/DlTypography.vue +3 -0
- package/src/demo/DlCounterDemo.vue +1 -1
package/package.json
CHANGED
|
@@ -72,8 +72,8 @@ export default defineComponent({
|
|
|
72
72
|
},
|
|
73
73
|
props: {
|
|
74
74
|
counter: {
|
|
75
|
-
type: Object as PropType<DlKpiCounterType
|
|
76
|
-
default: () => ({})
|
|
75
|
+
type: Object as PropType<DlKpiCounterType>,
|
|
76
|
+
default: () => ({} as DlKpiCounterType)
|
|
77
77
|
},
|
|
78
78
|
counterFontSize: {
|
|
79
79
|
type: String,
|
|
@@ -107,7 +107,7 @@ export default defineComponent({
|
|
|
107
107
|
},
|
|
108
108
|
progress: {
|
|
109
109
|
type: Object as PropType<DlKpiProgressType>,
|
|
110
|
-
default: () => ({})
|
|
110
|
+
default: () => ({} as DlKpiProgressType)
|
|
111
111
|
},
|
|
112
112
|
withBorder: {
|
|
113
113
|
type: Boolean,
|
|
@@ -119,7 +119,7 @@ export default defineComponent({
|
|
|
119
119
|
default: false,
|
|
120
120
|
required: false
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
small: {
|
|
123
123
|
type: Boolean,
|
|
124
124
|
default: false,
|
|
125
125
|
required: false
|
|
@@ -132,17 +132,25 @@ export default defineComponent({
|
|
|
132
132
|
|
|
133
133
|
const emptyString = '---'
|
|
134
134
|
|
|
135
|
+
const isSingleWord = (text: string) => text.split(' ').length === 1
|
|
136
|
+
|
|
135
137
|
const cssVars = computed(() => {
|
|
136
138
|
return {
|
|
137
|
-
'--dl-kpi-border': props.withBorder ? '1px solid #e4e4e4' : ''
|
|
139
|
+
'--dl-kpi-border': props.withBorder ? '1px solid #e4e4e4' : '',
|
|
140
|
+
'--dl-kpi-title-max-width': isSingleWord(props.title)
|
|
141
|
+
? '100%'
|
|
142
|
+
: '90%', // todo: caused a bug with single words
|
|
143
|
+
'--dl-kpi-sub-title-max-width': isSingleWord(props.subtitle)
|
|
144
|
+
? '100%'
|
|
145
|
+
: '90%'
|
|
138
146
|
}
|
|
139
147
|
})
|
|
140
148
|
|
|
141
149
|
const counterFontSizeComputed = computed(() =>
|
|
142
|
-
props.
|
|
150
|
+
props.small ? '20px' : props.counterFontSize
|
|
143
151
|
)
|
|
144
152
|
const titleFontSizeComputed = computed(() =>
|
|
145
|
-
props.
|
|
153
|
+
props.small ? '14px' : props.titleFontSize
|
|
146
154
|
)
|
|
147
155
|
|
|
148
156
|
const formatCounter = (counter: DlKpiCounterType) => {
|
|
@@ -243,7 +251,7 @@ export default defineComponent({
|
|
|
243
251
|
&__text {
|
|
244
252
|
display: flex;
|
|
245
253
|
flex-direction: row;
|
|
246
|
-
max-width:
|
|
254
|
+
max-width: var(--dl-kpi-title-max-width);
|
|
247
255
|
max-height: 40px;
|
|
248
256
|
font-style: normal;
|
|
249
257
|
font-weight: 400;
|
|
@@ -255,7 +263,7 @@ export default defineComponent({
|
|
|
255
263
|
gap: 10px;
|
|
256
264
|
}
|
|
257
265
|
&__subtext {
|
|
258
|
-
max-width:
|
|
266
|
+
max-width: var(--dl-kpi-sub-title-max-width);
|
|
259
267
|
max-height: 40px;
|
|
260
268
|
font-style: normal;
|
|
261
269
|
font-weight: 400;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
>
|
|
13
13
|
<div :class="computeClass('item-content')">
|
|
14
14
|
<dl-kpi
|
|
15
|
-
:counter="item.value"
|
|
15
|
+
:counter="kpiValue(item.value)"
|
|
16
16
|
counter-font-size="30px"
|
|
17
17
|
:title="capitalize(item.text)"
|
|
18
18
|
title-font-size="16px"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
subtitle-font-size="12px"
|
|
21
21
|
:info-message="null"
|
|
22
22
|
:progress="null"
|
|
23
|
-
:
|
|
23
|
+
:small="small"
|
|
24
24
|
/>
|
|
25
25
|
</div>
|
|
26
26
|
<div class="divider" />
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import { v4 } from 'uuid'
|
|
34
34
|
import { defineComponent, PropType } from 'vue-demi'
|
|
35
35
|
import { DlKpi } from '../../basic'
|
|
36
|
+
import { DlKpiCounterFormat } from '../../types'
|
|
36
37
|
|
|
37
38
|
interface CounterItem {
|
|
38
39
|
value?: number
|
|
@@ -84,6 +85,12 @@ export default defineComponent({
|
|
|
84
85
|
},
|
|
85
86
|
computeClass(value: string): (string | boolean)[] {
|
|
86
87
|
return [value, this.small && `${value}--small`]
|
|
88
|
+
},
|
|
89
|
+
kpiValue(value: string | number) {
|
|
90
|
+
return {
|
|
91
|
+
value: value ?? 0,
|
|
92
|
+
format: DlKpiCounterFormat.long
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import DlItem from './DlItem.vue'
|
|
2
|
-
export
|
|
2
|
+
export { DlItem }
|