@milaboratories/uikit 2.2.39 → 2.2.41

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/uikit",
3
- "version": "2.2.39",
3
+ "version": "2.2.41",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -33,8 +33,8 @@
33
33
  "yarpm": "^1.2.0",
34
34
  "svgo": "^3.3.2",
35
35
  "@milaboratories/eslint-config": "^1.0.1",
36
- "@milaboratories/helpers": "^1.6.11",
37
- "@platforma-sdk/model": "^1.20.27"
36
+ "@platforma-sdk/model": "^1.21.0",
37
+ "@milaboratories/helpers": "^1.6.11"
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 fractionString = ((p.value / total) * 100).toFixed(1);
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="`left: ${v}%`"
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>
@@ -1,3 +1,4 @@
1
1
  export { default as PlChartStackedBar } from './PlChartStackedBar.vue';
2
+ export { default as PlChartStackedBarCompact } from './PlChartStackedBarCompact.vue';
2
3
 
3
4
  export * from './types';
@@ -7,18 +7,20 @@ export type PlChartStackedBarSegment = {
7
7
  color: string | Color;
8
8
  };
9
9
 
10
- export type PlChartStackedBarSettings = {
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.
@@ -0,0 +1,42 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import './pl-progress-cell.scss';
4
+ import PlMaskIcon24 from '../PlMaskIcon24/PlMaskIcon24.vue';
5
+ import type { PlProgressCellProps } from './types';
6
+
7
+ const props = withDefaults(defineProps<PlProgressCellProps>(), {
8
+ stage: 'not_started',
9
+ step: '',
10
+ progressString: '',
11
+ progress: undefined,
12
+ error: '',
13
+ });
14
+
15
+ const canShowWhiteBg = computed(() => props.stage !== 'not_started');
16
+
17
+ const currentProgress = computed(() => props.stage === 'done' ? 100 : Math.min(100, props.progress || 0));
18
+
19
+ const canShowInfinityLoader = computed(() => props.progress === undefined && props.stage !== 'done' && props.stage !== 'not_started' && !props.error);
20
+
21
+ console.log(props);
22
+ </script>
23
+
24
+ <template>
25
+ <div :class="{'progress-cell':true, 'progress-cell__white-bg': canShowWhiteBg, error, 'not-started': props.stage === 'not_started' }">
26
+ <div v-if="canShowInfinityLoader" class="progress-cell__infinity-loader">
27
+ <div class="progress-cell__infinity-gradient"/>
28
+ </div>
29
+ <div v-if="!canShowInfinityLoader && !error" class="progress-cell__indicator" :style="{ width: currentProgress + '%' }"/>
30
+ <div class="progress-cell__body">
31
+ <div class="progress-cell__stage text-s">
32
+ {{ error ? error : step }}
33
+ </div>
34
+ <div class="progress-cell__percentage text-s d-flex align-center justify-end">
35
+ <PlMaskIcon24 v-if="error" name="error" />
36
+ <template v-if="!error">
37
+ {{ progressString }}
38
+ </template>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </template>
@@ -0,0 +1,2 @@
1
+ export { default as PlProgressCell } from './PlProgressCell.vue';
2
+ export * from './types';
@@ -0,0 +1,88 @@
1
+ .progress-cell {
2
+ background-color: transparent;
3
+ height: 100%;
4
+ position: relative;
5
+ width: 100%;
6
+ overflow: hidden;
7
+ border-radius: 2px;
8
+
9
+ .mask-error {
10
+ background: var(--txt-error);
11
+ }
12
+
13
+ &.error {
14
+ * {
15
+ color: var(--txt-error) !important;
16
+ }
17
+ }
18
+
19
+ &.not-started {
20
+ * {
21
+ color: var(--txt-03) !important;
22
+ }
23
+ }
24
+
25
+ &__white-bg {
26
+ background-color: #fff;
27
+ }
28
+
29
+ &__indicator {
30
+ position: absolute;
31
+ height: 100%;
32
+ transition: width 0.4s ease-in-out;
33
+ background: linear-gradient(90deg, #fff 0%, #d8fac8 100%);
34
+ transition: width .2s ease-in-out;
35
+ }
36
+
37
+ &__body {
38
+ padding: 0 15px;
39
+ display: flex;
40
+ gap: 12px;
41
+ align-items: center;
42
+ height: 100%;
43
+ width: 100%;
44
+ position: absolute;
45
+ z-index: 1;
46
+ }
47
+
48
+ &__stage {
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ flex-shrink: 1;
52
+ text-wrap: nowrap;
53
+ }
54
+
55
+ &__percentage {
56
+ flex-grow: 1;
57
+ flex-shrink: 0;
58
+ text-align: right;
59
+ }
60
+
61
+ &__stage--queued {
62
+ color: var(--txt-03);
63
+ }
64
+
65
+ &__infinity-loader {
66
+ position: absolute;
67
+ inset: 0;
68
+ width: 100%;
69
+ height: 100%;
70
+ animation: move-gradient 2s linear infinite;
71
+ }
72
+
73
+ &__infinity-gradient {
74
+ width: 50%;
75
+ height: 100%;
76
+ background: linear-gradient(90deg, #FFF 0%, #D8FAC8 50%, #FFF 100%);
77
+ }
78
+ }
79
+
80
+ @keyframes move-gradient {
81
+ 0% {
82
+ transform: translateX(-50%);
83
+ }
84
+
85
+ 100% {
86
+ transform: translateX(100%);
87
+ }
88
+ }
@@ -0,0 +1,7 @@
1
+ export type PlProgressCellProps = {
2
+ stage: 'not_started' | 'running' | 'done';
3
+ step: string; // "Alignment" / "Queued"
4
+ progressString: string; // "20%" or "2 / 4"
5
+ progress?: number; // i.e. 0.2 for 20%; 'undefined' for unknown progress = animated progressbar
6
+ error?: string;
7
+ };
package/src/index.ts CHANGED
@@ -50,6 +50,7 @@ export * from './components/PlSectionSeparator';
50
50
  export * from './components/PlAccordion';
51
51
  export * from './components/PlStatusTag';
52
52
  export * from './components/PlLoaderCircular';
53
+ export * from './components/PlProgressCell';
53
54
 
54
55
  export * from './components/PlFileDialog';
55
56
  export * from './components/PlFileInput';