@dataloop-ai/components 0.19.22 → 0.19.24
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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<slot />
|
|
18
18
|
<span
|
|
19
19
|
class="th-icons"
|
|
20
|
-
:style="{ top:
|
|
20
|
+
:style="{ top: isDense ? '5px' : '10px' }"
|
|
21
21
|
>
|
|
22
22
|
<dl-icon
|
|
23
23
|
v-if="hasHint"
|
|
@@ -87,6 +87,10 @@ export default defineComponent({
|
|
|
87
87
|
return !!props.props?.col?.hint
|
|
88
88
|
})
|
|
89
89
|
|
|
90
|
+
const isDense = computed(() => {
|
|
91
|
+
return !!props.props?.dense
|
|
92
|
+
})
|
|
93
|
+
|
|
90
94
|
const column = computed(() => {
|
|
91
95
|
let col: any
|
|
92
96
|
const name = vm.vnode.key as string
|
|
@@ -110,7 +114,8 @@ export default defineComponent({
|
|
|
110
114
|
isSortable: false,
|
|
111
115
|
hasEllipsis: false,
|
|
112
116
|
onClick: onClickFn,
|
|
113
|
-
hasHint
|
|
117
|
+
hasHint,
|
|
118
|
+
isDense
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
|
|
@@ -140,6 +145,7 @@ export default defineComponent({
|
|
|
140
145
|
|
|
141
146
|
return {
|
|
142
147
|
hasHint,
|
|
148
|
+
isDense,
|
|
143
149
|
isSortable: !hasOptionalProps.value
|
|
144
150
|
? false
|
|
145
151
|
: column?.value?.sortable ?? false,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function abbreviateToString(num: number, precision: number = 1): string {
|
|
2
|
-
const abbreviations = [
|
|
3
|
-
{ value: 1e12, suffix: 'T' },
|
|
4
|
-
{ value: 1e9, suffix: 'B' },
|
|
5
|
-
{ value: 1e6, suffix: 'M' },
|
|
6
|
-
{ value: 1e3, suffix: 'K' }
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
const match = abbreviations.find((abb) => num >= abb.value)
|
|
10
|
-
if (!match) {
|
|
11
|
-
return num.toString()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const abbreviated = (num / match.value).toFixed(precision)
|
|
15
|
-
const formatted = Number(abbreviated).toString()
|
|
16
|
-
const suffix = match.suffix
|
|
17
|
-
|
|
18
|
-
if (formatted.includes('.')) {
|
|
19
|
-
return formatted.replace(/\.?0*$/, '') + suffix
|
|
20
|
-
} else {
|
|
21
|
-
return formatted + suffix
|
|
22
|
-
}
|
|
23
|
-
}
|