@milaboratories/uikit 2.2.40 → 2.2.42
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/CHANGELOG.md +12 -0
- package/dist/pl-uikit.js +1509 -1438
- package/dist/pl-uikit.umd.cjs +6 -6
- package/dist/src/components/PlChartStackedBar/PlChartStackedBarCompact.vue.d.ts +6 -0
- package/dist/src/components/PlChartStackedBar/StackedRow.vue.d.ts +0 -1
- package/dist/src/components/PlChartStackedBar/StackedRowCompact.vue.d.ts +7 -0
- package/dist/src/components/PlChartStackedBar/index.d.ts +1 -0
- package/dist/src/components/PlChartStackedBar/types.d.ts +8 -6
- package/dist/src/components/PlProgressCell/types.d.ts +2 -2
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/PlChartStackedBar/PlChartStackedBarCompact.vue +27 -0
- package/src/components/PlChartStackedBar/StackedRow.vue +9 -16
- package/src/components/PlChartStackedBar/StackedRowCompact.vue +87 -0
- package/src/components/PlChartStackedBar/index.ts +1 -0
- package/src/components/PlChartStackedBar/types.ts +9 -7
- package/src/components/PlProgressCell/types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/pl-uikit.umd.js",
|
|
6
6
|
"module": "dist/pl-uikit.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"vue-tsc": "^2.1.10",
|
|
33
33
|
"yarpm": "^1.2.0",
|
|
34
34
|
"svgo": "^3.3.2",
|
|
35
|
-
"@
|
|
35
|
+
"@platforma-sdk/model": "^1.21.0",
|
|
36
36
|
"@milaboratories/helpers": "^1.6.11",
|
|
37
|
-
"@
|
|
37
|
+
"@milaboratories/eslint-config": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "vite",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { PlChartStackedBarSettingsCompact } from './types';
|
|
4
|
+
import StackedRowCompact from './StackedRowCompact.vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
settings: PlChartStackedBarSettingsCompact;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const data = computed(() => {
|
|
11
|
+
return props.settings.data ?? [];
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div :class="$style.component">
|
|
17
|
+
<StackedRowCompact :value="data"/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style lang="scss" module>
|
|
22
|
+
.component {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { tapIf } from '@milaboratories/helpers';
|
|
3
2
|
import { computed } from 'vue';
|
|
4
3
|
import type { PlChartStackedBarSegment } from './types';
|
|
5
4
|
|
|
6
5
|
const props = defineProps<{
|
|
7
6
|
value: PlChartStackedBarSegment[];
|
|
8
7
|
height?: number;
|
|
9
|
-
showFractionInLabel?: boolean;
|
|
10
8
|
}>();
|
|
11
9
|
|
|
12
10
|
const style = computed(() => ({
|
|
13
|
-
height: '100%',
|
|
11
|
+
height: props.height ?? '100%',
|
|
14
12
|
minHeight: '82px',
|
|
15
13
|
}));
|
|
16
14
|
|
|
@@ -19,14 +17,7 @@ const parts = computed(() => {
|
|
|
19
17
|
const total = parts.reduce((res, it) => res + it.value, 0);
|
|
20
18
|
return parts.map((p) => {
|
|
21
19
|
const fraction = (p.value / total) * 100;
|
|
22
|
-
const
|
|
23
|
-
const label = tapIf(p.label, (label) => {
|
|
24
|
-
if (props.showFractionInLabel) {
|
|
25
|
-
return `${label} ${fractionString}%`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return label;
|
|
29
|
-
});
|
|
20
|
+
const label = p.label;
|
|
30
21
|
return {
|
|
31
22
|
color: p.color.toString(),
|
|
32
23
|
description: p.description,
|
|
@@ -35,6 +26,8 @@ const parts = computed(() => {
|
|
|
35
26
|
};
|
|
36
27
|
});
|
|
37
28
|
});
|
|
29
|
+
|
|
30
|
+
const trackTransforms = [-40, -50, -50, -50, -80];
|
|
38
31
|
</script>
|
|
39
32
|
|
|
40
33
|
<template>
|
|
@@ -45,7 +38,10 @@ const parts = computed(() => {
|
|
|
45
38
|
<div
|
|
46
39
|
v-for="(v, i) in [0, 25, 50, 75, 100]"
|
|
47
40
|
:key="i"
|
|
48
|
-
:style="
|
|
41
|
+
:style="{
|
|
42
|
+
left: `${v}%`,
|
|
43
|
+
'--transform': `translateX(${trackTransforms[i]}%)`
|
|
44
|
+
}"
|
|
49
45
|
:data-content="`${v}%`"
|
|
50
46
|
/>
|
|
51
47
|
</div>
|
|
@@ -69,8 +65,6 @@ const parts = computed(() => {
|
|
|
69
65
|
height: auto;
|
|
70
66
|
position: relative;
|
|
71
67
|
overflow: visible;
|
|
72
|
-
border: 1px solid green;
|
|
73
|
-
|
|
74
68
|
border: 1px solid var(--txt-01);
|
|
75
69
|
padding: 12px 6px;
|
|
76
70
|
border-radius: 0;
|
|
@@ -80,7 +74,6 @@ const parts = computed(() => {
|
|
|
80
74
|
.container {
|
|
81
75
|
display: flex;
|
|
82
76
|
flex-direction: row;
|
|
83
|
-
gap: 1px;
|
|
84
77
|
width: 100%;
|
|
85
78
|
height: 100%;
|
|
86
79
|
align-items: center;
|
|
@@ -107,9 +100,9 @@ const parts = computed(() => {
|
|
|
107
100
|
&::after {
|
|
108
101
|
position: absolute;
|
|
109
102
|
content: attr(data-content);
|
|
103
|
+
transform: var(--transform);
|
|
110
104
|
left: 0;
|
|
111
105
|
bottom: -24px;
|
|
112
|
-
transform: translateX(-50%);
|
|
113
106
|
}
|
|
114
107
|
}
|
|
115
108
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { PlChartStackedBarSegment } from './types';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
value: PlChartStackedBarSegment[];
|
|
7
|
+
height?: number;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const style = computed(() => ({
|
|
11
|
+
height: props.height ?? '100%',
|
|
12
|
+
minHeight: '24px',
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
const parts = computed(() => {
|
|
16
|
+
const parts = props.value || [];
|
|
17
|
+
const total = parts.reduce((res, it) => res + it.value, 0);
|
|
18
|
+
return parts.map((p) => {
|
|
19
|
+
const fraction = (p.value / total) * 100;
|
|
20
|
+
const label = p.label;
|
|
21
|
+
return {
|
|
22
|
+
color: p.color.toString(),
|
|
23
|
+
description: p.description,
|
|
24
|
+
fraction,
|
|
25
|
+
label,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div
|
|
33
|
+
:class="[$style.component]" :style="style"
|
|
34
|
+
>
|
|
35
|
+
<div :class="$style.container">
|
|
36
|
+
<div v-if="!parts.length" :class="$style.notReady">Not ready</div>
|
|
37
|
+
<div
|
|
38
|
+
v-for="(p, i) in parts"
|
|
39
|
+
:key="i"
|
|
40
|
+
:title.prop="p.description ?? p.label"
|
|
41
|
+
:style="{
|
|
42
|
+
width: `${p.fraction}%`,
|
|
43
|
+
backgroundColor: p.color
|
|
44
|
+
}"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style lang="scss" module>
|
|
51
|
+
.component {
|
|
52
|
+
display: flex;
|
|
53
|
+
position: relative;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
padding: 0;
|
|
56
|
+
border-radius: 2px;
|
|
57
|
+
|
|
58
|
+
.notReady {
|
|
59
|
+
font-size: larger;
|
|
60
|
+
font-weight: bolder;
|
|
61
|
+
color: var(--txt-mask);
|
|
62
|
+
margin-left: 24px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.container {
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.container {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
width: 100%;
|
|
74
|
+
flex: 1;
|
|
75
|
+
align-items: center;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
> div {
|
|
78
|
+
height: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.notReady {
|
|
85
|
+
color: var(--txt-03) !important;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -7,18 +7,20 @@ export type PlChartStackedBarSegment = {
|
|
|
7
7
|
color: string | Color;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type
|
|
11
|
-
/**
|
|
12
|
-
* The title of the chart.
|
|
13
|
-
* This will be displayed at the top of the chart, if provided.
|
|
14
|
-
*/
|
|
15
|
-
title?: string;
|
|
16
|
-
|
|
10
|
+
export type PlChartStackedBarSettingsCompact = {
|
|
17
11
|
/**
|
|
18
12
|
* The data to be displayed in the chart.
|
|
19
13
|
* Each entry represents a segment of a stacked bar.
|
|
20
14
|
*/
|
|
21
15
|
data: PlChartStackedBarSegment[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type PlChartStackedBarSettings = PlChartStackedBarSettingsCompact & {
|
|
19
|
+
/**
|
|
20
|
+
* The title of the chart.
|
|
21
|
+
* This will be displayed at the top of the chart, if provided.
|
|
22
|
+
*/
|
|
23
|
+
title?: string;
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* The maximum number of legends displayed in a single column.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type PlProgressCellProps = {
|
|
2
2
|
stage: 'not_started' | 'running' | 'done';
|
|
3
|
-
step
|
|
4
|
-
progressString
|
|
3
|
+
step?: string; // "Alignment" / "Queued"
|
|
4
|
+
progressString?: string; // "20%" or "2 / 4"
|
|
5
5
|
progress?: number; // i.e. 0.2 for 20%; 'undefined' for unknown progress = animated progressbar
|
|
6
6
|
error?: string;
|
|
7
7
|
};
|