@v1nt1248/3nclient-lib 0.0.42 → 0.1.1
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/README.md +7 -4
- package/dist/components/index.d.ts +23 -19
- package/dist/components/ui3n-badge-simple.vue.d.ts +2 -2
- package/dist/components/ui3n-badge.vue.d.ts +1 -1
- package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
- package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
- package/dist/components/ui3n-button.vue.d.ts +30 -4
- package/dist/components/ui3n-checkbox.vue.d.ts +2 -2
- package/dist/components/ui3n-chip.vue.d.ts +2 -2
- package/dist/components/ui3n-dialog.vue.d.ts +4 -4
- package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
- package/dist/components/ui3n-emoji.vue.d.ts +2 -2
- package/dist/components/ui3n-icon.vue.d.ts +29 -3
- package/dist/components/ui3n-input.vue.d.ts +18 -11
- package/dist/components/ui3n-list.vue.d.ts +1 -1
- package/dist/components/ui3n-menu.vue.d.ts +2 -2
- package/dist/components/ui3n-notification.vue.d.ts +30 -1
- package/dist/components/ui3n-progress-circular.vue.d.ts +43 -0
- package/dist/components/ui3n-progress-linear.vue.d.ts +42 -0
- package/dist/components/ui3n-step-line-bar.vue.d.ts +30 -0
- package/dist/components/ui3n-switch.vue.d.ts +55 -0
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
- package/dist/components/ui3n-table.vue.d.ts +2 -2
- package/dist/components/ui3n-tabs.vue.d.ts +2 -2
- package/dist/components/ui3n-text.vue.d.ts +29 -3
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +9 -6
- package/dist/constants/types.d.ts +2 -4
- package/dist/directives/index.d.ts +1 -1
- package/dist/index.d.ts +31 -27
- package/dist/plugins/dialogs.d.ts +1 -1
- package/dist/plugins/index.d.ts +8 -8
- package/dist/plugins/notifications.d.ts +1 -1
- package/dist/plugins/vue-bus.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -3
- package/dist/ui-3n-lib.js +7273 -6748
- package/package.json +58 -59
- package/src/components/index.ts +59 -41
- package/src/components/ui3n-badge-simple.vue +35 -38
- package/src/components/ui3n-badge.vue +25 -25
- package/src/components/ui3n-breadcrumb.vue +44 -44
- package/src/components/ui3n-breadcrumbs.vue +19 -19
- package/src/components/ui3n-button.vue +246 -150
- package/src/components/ui3n-checkbox.vue +199 -158
- package/src/components/ui3n-chip.vue +96 -98
- package/src/components/ui3n-dialog.vue +225 -235
- package/src/components/ui3n-drop-files.vue +146 -154
- package/src/components/ui3n-emoji.vue +62 -64
- package/src/components/ui3n-icon.vue +32 -13
- package/src/components/ui3n-input.vue +283 -215
- package/src/components/ui3n-list.vue +92 -111
- package/src/components/ui3n-menu.vue +101 -100
- package/src/components/ui3n-notification.vue +182 -113
- package/src/components/ui3n-progress-circular.vue +188 -0
- package/src/components/ui3n-progress-linear.vue +119 -0
- package/src/components/ui3n-step-line-bar.vue +66 -0
- package/src/components/ui3n-switch.vue +146 -0
- package/src/components/ui3n-table-sort-icon.vue +1 -2
- package/src/components/ui3n-table.vue +233 -228
- package/src/components/ui3n-tabs.vue +141 -148
- package/src/components/ui3n-text.vue +235 -146
- package/src/components/ui3n-virtual-scroll.vue +68 -68
|
@@ -1,133 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { onMounted } from 'vue';
|
|
3
|
+
import Ui3nIcon from './ui3n-icon.vue';
|
|
4
|
+
import Ui3nButton from './ui3n-button.vue';
|
|
5
|
+
import type { Ui3nNotificationProps } from '../constants';
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<Ui3nNotificationProps>(),
|
|
9
|
+
{
|
|
10
|
+
type: 'info',
|
|
11
|
+
position: 'center',
|
|
12
|
+
duration: 0,
|
|
13
|
+
withIcon: true,
|
|
14
|
+
onOpen: () => void (0),
|
|
15
|
+
onClose: () => void (0),
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const stylesByTypes = {
|
|
20
|
+
success: {
|
|
21
|
+
color: 'var(--success-content-default)',
|
|
22
|
+
icon: 'warning',
|
|
23
|
+
iconColor: 'var(--success-fill-default)',
|
|
24
|
+
iconRotate: 0,
|
|
25
|
+
},
|
|
26
|
+
warning: {
|
|
27
|
+
color: 'var(--warning-content-default)',
|
|
28
|
+
icon: 'warning',
|
|
29
|
+
iconColor: 'var(--warning-fill-default)',
|
|
30
|
+
iconRotate: 0,
|
|
31
|
+
},
|
|
32
|
+
info: {
|
|
33
|
+
color: 'var(--info-content-default)',
|
|
34
|
+
icon: 'info',
|
|
35
|
+
iconColor: 'var(--info-fill-default)',
|
|
36
|
+
iconRotate: 90,
|
|
37
|
+
},
|
|
38
|
+
error: {
|
|
39
|
+
color: 'var(--error-content-default)',
|
|
40
|
+
icon: 'info',
|
|
41
|
+
iconColor: 'var(--error-fill-default)',
|
|
42
|
+
iconRotate: 90,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
if (props.duration > 500) {
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
props.onClose();
|
|
50
|
+
}, props.duration);
|
|
26
51
|
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const closeNotification = () => {
|
|
55
|
+
props.onClose();
|
|
56
|
+
};
|
|
27
57
|
</script>
|
|
28
58
|
|
|
29
59
|
<template>
|
|
30
60
|
<div
|
|
31
|
-
:id="
|
|
32
|
-
:class="[
|
|
33
|
-
'ui3n-notification',
|
|
34
|
-
`ui3n-notification--${params.type}`,
|
|
35
|
-
`ui3n-notification--${params.position}`,
|
|
36
|
-
{
|
|
37
|
-
'ui3n-notification--with-icon': params.icon,
|
|
38
|
-
},
|
|
39
|
-
]"
|
|
61
|
+
:id="id"
|
|
62
|
+
:class="[$style.notification, $style[`${type}Type`], $style[`${position}Position`], withIcon && $style.withIcon]"
|
|
40
63
|
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
<div v-if="withIcon" :class="$style.icon">
|
|
65
|
+
<ui3n-icon
|
|
66
|
+
:icon="stylesByTypes[type].icon"
|
|
67
|
+
width="16"
|
|
68
|
+
height="16"
|
|
69
|
+
:rotate="stylesByTypes[type].iconRotate"
|
|
70
|
+
:color="stylesByTypes[type].iconColor"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
48
73
|
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
|
|
75
|
+
<div :class="$style.content">
|
|
76
|
+
{{ content }}
|
|
51
77
|
</div>
|
|
52
78
|
|
|
53
79
|
<ui3n-button
|
|
54
80
|
v-if="!props.duration"
|
|
55
|
-
|
|
81
|
+
type="icon"
|
|
82
|
+
size="small"
|
|
56
83
|
color="transparent"
|
|
57
84
|
icon="close"
|
|
58
|
-
icon-
|
|
59
|
-
|
|
60
|
-
class="ui3n-notification__close"
|
|
85
|
+
:icon-color="stylesByTypes[type].color"
|
|
86
|
+
:class="$style.closeBtn"
|
|
61
87
|
@click="closeNotification"
|
|
62
88
|
/>
|
|
63
89
|
</div>
|
|
64
90
|
</template>
|
|
65
91
|
|
|
66
|
-
<style lang="scss"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
92
|
+
<style lang="scss" module>
|
|
93
|
+
.notification {
|
|
94
|
+
--ui3n-notification-width: 380px;
|
|
95
|
+
|
|
96
|
+
display: flex;
|
|
97
|
+
position: relative;
|
|
98
|
+
z-index: 5000;
|
|
99
|
+
border-radius: var(--spacing-s);
|
|
100
|
+
outline: 1px solid var(--color-border-control-tritery-default);
|
|
101
|
+
padding: var(--spacing-m);
|
|
102
|
+
max-width: var(--ui3n-notification-width);
|
|
103
|
+
margin-bottom: var(--spacing-s);
|
|
104
|
+
justify-content: center;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: var(--spacing-s);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.withIcon {
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.icon {
|
|
114
|
+
position: relative;
|
|
115
|
+
min-width: var(--spacing-l);
|
|
116
|
+
width: var(--spacing-l);
|
|
117
|
+
min-height: var(--spacing-l);
|
|
118
|
+
height: var(--spacing-l);
|
|
119
|
+
border-radius: 50%;
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.content {
|
|
126
|
+
position: relative;
|
|
127
|
+
flex-grow: 2;
|
|
128
|
+
font-size: var(--font-12);
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
line-height: var(--font-16);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.closeBtn {
|
|
134
|
+
position: absolute;
|
|
135
|
+
z-index: 1;
|
|
136
|
+
top: 0;
|
|
137
|
+
right: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.infoType {
|
|
141
|
+
background-color: var(--info-fill-default);
|
|
142
|
+
|
|
143
|
+
.icon {
|
|
144
|
+
background-color: var(--info-content-default);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.content {
|
|
148
|
+
color: var(--info-content-default);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.successType {
|
|
153
|
+
background-color: var(--success-fill-default);
|
|
154
|
+
|
|
155
|
+
.icon {
|
|
156
|
+
background-color: var(--success-content-default);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.content {
|
|
160
|
+
color: var(--success-content-default);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.warningType {
|
|
165
|
+
background-color: var(--warning-fill-default);
|
|
166
|
+
|
|
167
|
+
.icon {
|
|
168
|
+
background-color: var(--warning-content-default);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.content {
|
|
172
|
+
color: var(--warning-content-default);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.errorType {
|
|
177
|
+
background-color: var(--error-fill-default);
|
|
178
|
+
|
|
179
|
+
.icon {
|
|
180
|
+
background-color: var(--error-content-default);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.content {
|
|
184
|
+
color: var(--error-content-default);
|
|
132
185
|
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.leftPosition {
|
|
189
|
+
margin-left: 0;
|
|
190
|
+
margin-right: auto;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.centerPosition {
|
|
194
|
+
margin-left: auto;
|
|
195
|
+
margin-right: auto;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.rightPosition {
|
|
199
|
+
margin-left: auto;
|
|
200
|
+
margin-right: 0;
|
|
201
|
+
}
|
|
133
202
|
</style>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, onBeforeMount, onBeforeUnmount, ref, useCssModule } from 'vue';
|
|
3
|
+
import { toNumber } from 'lodash';
|
|
4
|
+
|
|
5
|
+
export interface Ui3nProgressCircularProps {
|
|
6
|
+
value?: number | string;
|
|
7
|
+
size?: number | string;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
withText?: boolean;
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const thresholdSize = 64;
|
|
16
|
+
const indeterminateModeValues = [1, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 85, 90, 95, 99];
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(
|
|
19
|
+
defineProps<Ui3nProgressCircularProps>(),
|
|
20
|
+
{
|
|
21
|
+
value: 0,
|
|
22
|
+
size: 64,
|
|
23
|
+
bgColor: 'var(--color-bg-control-primary-default)',
|
|
24
|
+
color: 'var(--color-bg-control-accent-default)',
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const $style = useCssModule();
|
|
29
|
+
|
|
30
|
+
const element = ref<HTMLDivElement>();
|
|
31
|
+
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
32
|
+
|
|
33
|
+
const innerSize = computed(() => toNumber(props.size));
|
|
34
|
+
const cssSize = computed(() => `${innerSize.value}px`);
|
|
35
|
+
const innerWidth = computed(() => {
|
|
36
|
+
if (props.width) {
|
|
37
|
+
return toNumber(props.width);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const diff = innerSize.value - thresholdSize;
|
|
41
|
+
if (diff <= 0) {
|
|
42
|
+
return Math.round(innerSize.value / 10);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return 6 + Math.round(diff / 20);
|
|
46
|
+
});
|
|
47
|
+
const cssWidth = computed(() => `${innerWidth.value}px`);
|
|
48
|
+
const innerValue = computed(() => toNumber(props.value));
|
|
49
|
+
const fontSize = computed(() => `${Math.floor((innerSize.value - 2 * innerWidth.value) / 3.2)}px`);
|
|
50
|
+
|
|
51
|
+
const circleRadius = computed(() => Math.round(innerSize.value / 2) - Math.round(innerWidth.value / 2));
|
|
52
|
+
const circumference = computed(() => Math.round(Math.PI * 2 * circleRadius.value));
|
|
53
|
+
|
|
54
|
+
const timerId = ref();
|
|
55
|
+
const indeterminateModeValue = ref(0);
|
|
56
|
+
|
|
57
|
+
const strokeDasharray = computed(() => {
|
|
58
|
+
const value = props.indeterminate ? indeterminateModeValue.value : innerValue.value;
|
|
59
|
+
const dash = Math.round(circumference.value * value! / 100);
|
|
60
|
+
const gap = circumference.value - dash;
|
|
61
|
+
return `${dash} ${gap}`;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
function changeValueForIndeterminateMode() {
|
|
65
|
+
const indeterminateModeValuesLength = indeterminateModeValues.length;
|
|
66
|
+
let index = 0;
|
|
67
|
+
timerId.value = setInterval(() => {
|
|
68
|
+
indeterminateModeValue.value = indeterminateModeValues[index % indeterminateModeValuesLength];
|
|
69
|
+
index += 1;
|
|
70
|
+
if ((index % indeterminateModeValuesLength) === 1) {
|
|
71
|
+
if (element.value?.classList.contains($style.inverse)) {
|
|
72
|
+
element.value?.classList.remove($style.inverse);
|
|
73
|
+
} else {
|
|
74
|
+
element.value?.classList.add($style.inverse);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, 200);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onBeforeMount(() => {
|
|
81
|
+
if (props.indeterminate) {
|
|
82
|
+
changeValueForIndeterminateMode();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
onBeforeUnmount(() => {
|
|
87
|
+
clearInterval(timerId.value);
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<div ref="element" :class="[$style.progress, indeterminate && $style.indeterminate]">
|
|
93
|
+
<svg :height="innerSize" :width="innerSize" :class="$style.pie" xmlns="http://www.w3.org/2000/svg">
|
|
94
|
+
<circle :class="$style.background" :r="circleRadius" cx="50%" cy="50%" />
|
|
95
|
+
<circle :class="$style.chart" :r="circleRadius" cx="50%" cy="50%" :stroke-dasharray="strokeDasharray" />
|
|
96
|
+
</svg>
|
|
97
|
+
|
|
98
|
+
<div
|
|
99
|
+
v-if="isValueShown"
|
|
100
|
+
:class="$style.text"
|
|
101
|
+
>
|
|
102
|
+
{{ innerValue }}%
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<style lang="scss" module>
|
|
108
|
+
.progress {
|
|
109
|
+
--ui3n-progress-circular-size: v-bind(cssSize);
|
|
110
|
+
--ui3n-progress-circular-width: v-bind(cssWidth);
|
|
111
|
+
--ui3n-progress-circular-font-size: v-bind(fontSize);
|
|
112
|
+
--ui3n-progress-circular-bg: v-bind(bgColor);
|
|
113
|
+
--ui3n-progress-circular-color: v-bind(color);
|
|
114
|
+
|
|
115
|
+
position: relative;
|
|
116
|
+
min-width: var(--ui3n-progress-circular-size);
|
|
117
|
+
width: var(--ui3n-progress-circular-size);
|
|
118
|
+
min-height: var(--ui3n-progress-circular-size);
|
|
119
|
+
height: var(--ui3n-progress-circular-size);
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
|
|
122
|
+
&.inverse {
|
|
123
|
+
.background {
|
|
124
|
+
stroke: var(--ui3n-progress-circular-color) !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.chart {
|
|
128
|
+
stroke: var(--ui3n-progress-circular-bg) !important;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&:not(.indeterminate) {
|
|
133
|
+
.chart {
|
|
134
|
+
transition: 0.2s ease-in-out all;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.pie {
|
|
140
|
+
min-width: var(--ui3n-progress-circular-size);
|
|
141
|
+
width: var(--ui3n-progress-circular-size);
|
|
142
|
+
min-height: var(--ui3n-progress-circular-size);
|
|
143
|
+
height: var(--ui3n-progress-circular-size);
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
transform: rotate(-90deg);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.background {
|
|
149
|
+
fill: none;
|
|
150
|
+
stroke: var(--ui3n-progress-circular-bg);
|
|
151
|
+
stroke-width: var(--ui3n-progress-circular-width);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.chart {
|
|
155
|
+
fill: none;
|
|
156
|
+
stroke: var(--ui3n-progress-circular-color);
|
|
157
|
+
stroke-width: var(--ui3n-progress-circular-width);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.text {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 0;
|
|
163
|
+
left: 0;
|
|
164
|
+
width: 100%;
|
|
165
|
+
height: 100%;
|
|
166
|
+
display: flex;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
align-items: center;
|
|
169
|
+
font-size: var(--ui3n-progress-circular-font-size);
|
|
170
|
+
font-weight: 500;
|
|
171
|
+
color: var(--ui3n-progress-circular-color);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.indeterminate {
|
|
175
|
+
.pie {
|
|
176
|
+
animation: 0.75s linear 0s infinite normal spin;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes spin {
|
|
181
|
+
0% {
|
|
182
|
+
transform: rotate(-90deg);
|
|
183
|
+
}
|
|
184
|
+
100% {
|
|
185
|
+
transform: rotate(270deg);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { toNumber } from 'lodash';
|
|
4
|
+
|
|
5
|
+
export interface Ui3nProgressLinearProps {
|
|
6
|
+
value?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
withText?: boolean;
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const thresholdHeight = 12;
|
|
15
|
+
const thresholdValue = 5;
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(
|
|
18
|
+
defineProps<Ui3nProgressLinearProps>(),
|
|
19
|
+
{
|
|
20
|
+
value: 0,
|
|
21
|
+
height: 2,
|
|
22
|
+
bgColor: 'var(--color-bg-control-primary-default)',
|
|
23
|
+
color: 'var(--color-bg-control-accent-default)',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
28
|
+
const innerHeight = computed(() => toNumber(props.height));
|
|
29
|
+
const cssHeight = computed(() => `${innerHeight.value}px`);
|
|
30
|
+
const innerValue = computed(() => toNumber(props.value));
|
|
31
|
+
const displayValue = computed(() => props.indeterminate
|
|
32
|
+
? `20%`
|
|
33
|
+
: `${Math.min(innerValue.value, 100)}%`,
|
|
34
|
+
);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div :class="[$style.progress, indeterminate && $style.indeterminate]">
|
|
39
|
+
<div
|
|
40
|
+
v-if="isValueShown && innerHeight < thresholdHeight"
|
|
41
|
+
:class="[$style.text, $style.above]"
|
|
42
|
+
>
|
|
43
|
+
{{ displayValue }}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div :class="$style.body">
|
|
47
|
+
<div :class="$style.value" :style="{ width: displayValue }">
|
|
48
|
+
<div
|
|
49
|
+
v-if="isValueShown && innerHeight >= thresholdHeight && innerValue >= thresholdValue"
|
|
50
|
+
:class="$style.text"
|
|
51
|
+
>
|
|
52
|
+
{{ displayValue }}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" module>
|
|
60
|
+
.progress {
|
|
61
|
+
--ui3n-progress-linear-height: v-bind(cssHeight);
|
|
62
|
+
--ui3n-progress-linear-bg: v-bind(bgColor);
|
|
63
|
+
--ui3n-progress-linear-color: v-bind(color);
|
|
64
|
+
|
|
65
|
+
position: relative;
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.body {
|
|
70
|
+
position: relative;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: var(--ui3n-progress-linear-height);
|
|
73
|
+
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
74
|
+
background-color: var(--ui3n-progress-linear-bg);
|
|
75
|
+
overflow-x: hidden;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.value {
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
position: absolute;
|
|
83
|
+
left: 0;
|
|
84
|
+
height: var(--ui3n-progress-linear-height);
|
|
85
|
+
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
86
|
+
background-color: var(--ui3n-progress-linear-color);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.text {
|
|
90
|
+
font-size: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
line-height: var(--ui3n-progress-linear-height);
|
|
93
|
+
color: var(--ui3n-progress-linear-bg);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.above {
|
|
97
|
+
position: relative;
|
|
98
|
+
width: 100%;
|
|
99
|
+
text-align: center;
|
|
100
|
+
font-size: var(--font-14);
|
|
101
|
+
line-height: var(--font-16);
|
|
102
|
+
color: var(--color-bg-control-accent-default);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.indeterminate {
|
|
106
|
+
.value {
|
|
107
|
+
animation: 1s linear 0s infinite normal move;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@keyframes move {
|
|
112
|
+
from {
|
|
113
|
+
left: -22%
|
|
114
|
+
}
|
|
115
|
+
to {
|
|
116
|
+
left: 122%
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
export interface Ui3nStepLineBarProps {
|
|
3
|
+
label: string;
|
|
4
|
+
current: number;
|
|
5
|
+
steps: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
withDefaults(
|
|
9
|
+
defineProps<Ui3nStepLineBarProps>(),
|
|
10
|
+
{
|
|
11
|
+
current: 1,
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div :class="$style.stepLineBar">
|
|
18
|
+
<div :class="$style.label">
|
|
19
|
+
{{ label }}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div :class="$style.body">
|
|
23
|
+
<div v-for="step in steps" :class="[$style.step, step <= current && $style.active]" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style lang="scss" module>
|
|
29
|
+
.stepLineBar {
|
|
30
|
+
--ui3n-step-line-bar-steps: v-bind(steps);
|
|
31
|
+
|
|
32
|
+
position: relative;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.label {
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
text-align: center;
|
|
40
|
+
font-size: var(--font-14);
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
line-height: var(--font-20);
|
|
43
|
+
color: var(--color-text-block-accent-default);
|
|
44
|
+
margin-bottom: var(--spacing-m);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.body {
|
|
48
|
+
display: flex;
|
|
49
|
+
width: 100%;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--spacing-s);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.step {
|
|
56
|
+
position: relative;
|
|
57
|
+
width: calc((100% - (calc(var(--ui3n-step-line-bar-steps) - 1) * var(--spacing-s))) / var(--ui3n-step-line-bar-steps));
|
|
58
|
+
height: var(--spacing-xs);
|
|
59
|
+
border-radius: var(--spacing-xs);
|
|
60
|
+
background-color: var(--color-bg-control-secondary-default);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.active {
|
|
64
|
+
background-color: var(--color-bg-control-accent-default);
|
|
65
|
+
}
|
|
66
|
+
</style>
|