@v1nt1248/3nclient-lib 0.3.28 → 0.3.29
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/dist/chunks/ui3n-notification-Dr_3Td9N.js +279 -0
- package/dist/components/index.d.ts +12 -12
- package/dist/components/ui3n-autocomplete/types.d.ts +8 -0
- package/dist/components/ui3n-autocomplete/ui3n-autocomplete.d.ts +2 -2
- package/dist/components/ui3n-badge/types.d.ts +12 -0
- package/dist/components/ui3n-badge/ui3n-badge-simple.d.ts +1 -1
- package/dist/components/ui3n-badge/ui3n-badge.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/types.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +2 -2
- package/dist/components/ui3n-button/types.d.ts +4 -2
- package/dist/components/ui3n-checkbox/types.d.ts +11 -0
- package/dist/components/ui3n-checkbox/ui3n-checkbox.d.ts +4 -1
- package/dist/components/ui3n-chip/types.d.ts +6 -1
- package/dist/components/ui3n-chip/ui3n-chip.d.ts +2 -0
- package/dist/components/ui3n-drop-files/types.d.ts +7 -0
- package/dist/components/ui3n-drop-files/ui3n-drop-files.d.ts +7 -1
- package/dist/components/ui3n-editable/types.d.ts +11 -0
- package/dist/components/ui3n-editable/ui3n-editable.d.ts +4 -2
- package/dist/components/ui3n-icon/types.d.ts +5 -1
- package/dist/components/ui3n-icon/ui3n-icon.d.ts +2 -2
- package/dist/components/ui3n-input/types.d.ts +4 -0
- package/dist/components/ui3n-input/ui3n-input.d.ts +4 -1
- package/dist/components/ui3n-input-file/types.d.ts +11 -0
- package/dist/components/ui3n-input-file/ui3n-input-file.d.ts +4 -1
- package/dist/components/ui3n-list/types.d.ts +4 -0
- package/dist/components/ui3n-menu/types.d.ts +4 -0
- package/dist/components/ui3n-menu/ui3n-menu.d.ts +1 -1
- package/dist/components/ui3n-notification/ui3n-notification.d.ts +2 -2
- package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +1 -1
- package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +1 -1
- package/dist/components/ui3n-radio-group/types.d.ts +18 -0
- package/dist/components/ui3n-radio-group/ui3n-radio-group.d.ts +3 -1
- package/dist/components/ui3n-radio-group/ui3n-radio.d.ts +6 -7
- package/dist/components/ui3n-scrollbar-vertical/types.d.ts +2 -0
- package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +2 -0
- package/dist/components/ui3n-selector/types.d.ts +11 -0
- package/dist/components/ui3n-selector/ui3n-selector.d.ts +2 -2
- package/dist/components/ui3n-slider/types.d.ts +11 -0
- package/dist/components/ui3n-slider/ui3n-slider.d.ts +4 -1
- package/dist/components/ui3n-step-line-bar/types.d.ts +4 -0
- package/dist/components/ui3n-switch/types.d.ts +11 -0
- package/dist/components/ui3n-switch/ui3n-switch.d.ts +4 -1
- package/dist/components/ui3n-table/composables/useTable.d.ts +1 -0
- package/dist/components/ui3n-table/types.d.ts +4 -0
- package/dist/components/ui3n-table/ui3n-table-sort-icon.d.ts +4 -1
- package/dist/components/ui3n-tabs/types.d.ts +4 -0
- package/dist/components/ui3n-text/types.d.ts +11 -0
- package/dist/components/ui3n-text/ui3n-text.d.ts +4 -1
- package/dist/components/ui3n-tooltip/types.d.ts +4 -0
- package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +2066 -1690
- package/dist/ui3n-plugins.js +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +29 -7
- package/src/components/ui3n-autocomplete/types.ts +9 -1
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +182 -51
- package/src/components/ui3n-badge/types.ts +10 -0
- package/src/components/ui3n-badge/ui3n-badge-simple.vue +54 -55
- package/src/components/ui3n-badge/ui3n-badge.vue +4 -0
- package/src/components/ui3n-breadcrumbs/types.ts +1 -1
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +7 -5
- package/src/components/ui3n-button/types.ts +4 -2
- package/src/components/ui3n-button/ui3n-button.vue +24 -19
- package/src/components/ui3n-checkbox/types.ts +12 -0
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +79 -29
- package/src/components/ui3n-chip/types.ts +6 -1
- package/src/components/ui3n-chip/ui3n-chip.vue +64 -61
- package/src/components/ui3n-dialog/ui3n-dialog.vue +3 -3
- package/src/components/ui3n-drop-files/types.ts +8 -0
- package/src/components/ui3n-drop-files/ui3n-drop-files.vue +73 -29
- package/src/components/ui3n-editable/types.ts +12 -0
- package/src/components/ui3n-editable/ui3n-editable.vue +56 -24
- package/src/components/ui3n-icon/types.ts +5 -1
- package/src/components/ui3n-icon/ui3n-icon.vue +45 -50
- package/src/components/ui3n-input/types.ts +4 -0
- package/src/components/ui3n-input/ui3n-input.vue +14 -1
- package/src/components/ui3n-input-file/types.ts +12 -0
- package/src/components/ui3n-input-file/ui3n-input-file.vue +33 -16
- package/src/components/ui3n-list/types.ts +4 -0
- package/src/components/ui3n-list/ui3n-list.vue +3 -1
- package/src/components/ui3n-menu/types.ts +4 -0
- package/src/components/ui3n-menu/ui3n-menu.vue +43 -32
- package/src/components/ui3n-notification/ui3n-notification.vue +190 -175
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +40 -22
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +14 -7
- package/src/components/ui3n-radio-group/types.ts +20 -0
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +61 -48
- package/src/components/ui3n-radio-group/ui3n-radio.vue +60 -65
- package/src/components/ui3n-scrollbar-vertical/types.ts +2 -0
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +4 -4
- package/src/components/ui3n-selector/types.ts +12 -0
- package/src/components/ui3n-selector/ui3n-selector.vue +63 -40
- package/src/components/ui3n-slider/types.ts +12 -0
- package/src/components/ui3n-slider/ui3n-slider.vue +88 -39
- package/src/components/ui3n-step-line-bar/types.ts +4 -0
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +8 -10
- package/src/components/ui3n-switch/types.ts +12 -0
- package/src/components/ui3n-switch/ui3n-switch.vue +57 -25
- package/src/components/ui3n-table/composables/useTable.ts +17 -0
- package/src/components/ui3n-table/types.ts +4 -0
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -8
- package/src/components/ui3n-table/ui3n-table.vue +48 -17
- package/src/components/ui3n-tabs/types.ts +4 -0
- package/src/components/ui3n-tabs/ui3n-tabs.vue +146 -108
- package/src/components/ui3n-text/types.ts +12 -0
- package/src/components/ui3n-text/ui3n-text.vue +56 -15
- package/src/components/ui3n-tooltip/types.ts +4 -0
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +61 -43
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +201 -17
- package/dist/chunks/ui3n-notification-DlDM-u-R.js +0 -276
|
@@ -1,214 +1,229 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, onMounted, useCssModule } from 'vue';
|
|
3
|
-
import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
|
|
4
|
-
import Ui3nButton from '../ui3n-button/ui3n-button.vue';
|
|
5
|
-
import type { Ui3nNotificationProps } from './types';
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<Ui3nNotificationProps>(),
|
|
9
|
-
{
|
|
2
|
+
import { computed, onMounted, onBeforeUnmount, useCssModule } from 'vue';
|
|
3
|
+
import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
|
|
4
|
+
import Ui3nButton from '../ui3n-button/ui3n-button.vue';
|
|
5
|
+
import type { Ui3nNotificationProps } from './types';
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<Ui3nNotificationProps>(), {
|
|
10
8
|
type: 'info',
|
|
11
9
|
position: 'center',
|
|
12
10
|
duration: 0,
|
|
13
11
|
withIcon: true,
|
|
14
|
-
onOpen: () => void
|
|
15
|
-
onClose: () => void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onMounted(() => {
|
|
60
|
-
if (props.duration > 500) {
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
props.onClose();
|
|
63
|
-
}, props.duration);
|
|
12
|
+
onOpen: () => void 0,
|
|
13
|
+
onClose: () => void 0,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const $style = useCssModule();
|
|
17
|
+
|
|
18
|
+
const stylesByTypes = {
|
|
19
|
+
success: {
|
|
20
|
+
color: 'var(--success-content-default)',
|
|
21
|
+
icon: 'round-check-circle',
|
|
22
|
+
iconColor: 'var(--success-fill-default)',
|
|
23
|
+
iconRotate: 0,
|
|
24
|
+
},
|
|
25
|
+
warning: {
|
|
26
|
+
color: 'var(--warning-content-default)',
|
|
27
|
+
icon: 'round-warning',
|
|
28
|
+
iconColor: 'var(--warning-fill-default)',
|
|
29
|
+
iconRotate: 0,
|
|
30
|
+
},
|
|
31
|
+
info: {
|
|
32
|
+
color: 'var(--info-content-default)',
|
|
33
|
+
icon: 'round-info',
|
|
34
|
+
iconColor: 'var(--info-fill-default)',
|
|
35
|
+
iconRotate: 180,
|
|
36
|
+
},
|
|
37
|
+
error: {
|
|
38
|
+
color: 'var(--error-content-default)',
|
|
39
|
+
icon: 'round-info',
|
|
40
|
+
iconColor: 'var(--error-fill-default)',
|
|
41
|
+
iconRotate: 180,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let timerId: ReturnType<typeof setTimeout> | null = null;
|
|
46
|
+
|
|
47
|
+
const mainCssClasses = computed(() => {
|
|
48
|
+
const val = [$style.ui3nNotification, $style[`${props.type}Type`], $style[`${props.position}Position`]];
|
|
49
|
+
props.withIcon && val.push($style.withIcon);
|
|
50
|
+
|
|
51
|
+
return val;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function closeNotification() {
|
|
55
|
+
props.onClose && props.onClose();
|
|
64
56
|
}
|
|
65
|
-
|
|
57
|
+
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
props.onOpen && props.onOpen();
|
|
60
|
+
|
|
61
|
+
if (props.duration > 0) {
|
|
62
|
+
timerId = setTimeout(() => {
|
|
63
|
+
props.onClose();
|
|
64
|
+
}, props.duration);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
onBeforeUnmount(() => {
|
|
69
|
+
if (timerId) {
|
|
70
|
+
clearTimeout(timerId);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
66
73
|
</script>
|
|
67
74
|
|
|
68
75
|
<template>
|
|
69
|
-
<
|
|
70
|
-
:
|
|
71
|
-
:
|
|
76
|
+
<component
|
|
77
|
+
:is="teleport ? 'Teleport' : 'div'"
|
|
78
|
+
:to="teleport"
|
|
72
79
|
>
|
|
73
80
|
<div
|
|
74
|
-
|
|
75
|
-
:class="
|
|
81
|
+
:id="id"
|
|
82
|
+
:class="mainCssClasses"
|
|
76
83
|
>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
<div
|
|
85
|
+
v-if="withIcon"
|
|
86
|
+
:class="$style.ui3nNotificationIcon"
|
|
87
|
+
>
|
|
88
|
+
<ui3n-icon
|
|
89
|
+
:icon="stylesByTypes[type!].icon"
|
|
90
|
+
size="16"
|
|
91
|
+
:rotate="stylesByTypes[type!].iconRotate"
|
|
92
|
+
:color="stylesByTypes[type!].iconColor"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div :class="$style.ui3nNotificationContent">
|
|
97
|
+
{{ content }}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<ui3n-button
|
|
101
|
+
v-if="!duration"
|
|
102
|
+
type="icon"
|
|
103
|
+
size="small"
|
|
104
|
+
color="transparent"
|
|
105
|
+
icon="round-close"
|
|
106
|
+
:icon-color="stylesByTypes[type!].color"
|
|
107
|
+
icon-size="16"
|
|
108
|
+
:class="$style.closeBtn"
|
|
109
|
+
@click="closeNotification"
|
|
83
110
|
/>
|
|
84
111
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<div :class="$style.ui3nNotificationContent">
|
|
88
|
-
{{ content }}
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<ui3n-button
|
|
92
|
-
v-if="!duration"
|
|
93
|
-
type="icon"
|
|
94
|
-
size="small"
|
|
95
|
-
color="transparent"
|
|
96
|
-
icon="round-close"
|
|
97
|
-
:icon-color="stylesByTypes[type!].color"
|
|
98
|
-
:class="$style.closeBtn"
|
|
99
|
-
@click="closeNotification"
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
112
|
+
</component>
|
|
102
113
|
</template>
|
|
103
114
|
|
|
104
115
|
<style lang="scss" module>
|
|
105
|
-
.ui3nNotification {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
width: var(--spacing-l);
|
|
129
|
-
min-height: var(--spacing-l);
|
|
130
|
-
height: var(--spacing-l);
|
|
131
|
-
border-radius: 50%;
|
|
132
|
-
display: flex;
|
|
133
|
-
justify-content: center;
|
|
134
|
-
align-items: center;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.ui3nNotificationContent {
|
|
138
|
-
position: relative;
|
|
139
|
-
flex-grow: 2;
|
|
140
|
-
font-size: var(--font-12);
|
|
141
|
-
font-weight: 500;
|
|
142
|
-
line-height: var(--font-16);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.closeBtn {
|
|
146
|
-
position: absolute;
|
|
147
|
-
z-index: 1;
|
|
148
|
-
top: 0;
|
|
149
|
-
right: 0;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.infoType {
|
|
153
|
-
background-color: var(--info-fill-default);
|
|
116
|
+
.ui3nNotification {
|
|
117
|
+
--ui3n-notification-width: 380px;
|
|
118
|
+
--ui3n-notification-font-size: 12px;
|
|
119
|
+
--ui3n-notification-border-radius: 4px;
|
|
120
|
+
--ui3n-notification-margin-bottom: 4px;
|
|
121
|
+
--ui3n-notification-icon-size: 32px;
|
|
122
|
+
|
|
123
|
+
display: flex;
|
|
124
|
+
position: relative;
|
|
125
|
+
z-index: 5000;
|
|
126
|
+
border-radius: var(--ui3n-notification-border-radius);
|
|
127
|
+
outline: 1px solid var(--color-border-control-tritery-default);
|
|
128
|
+
padding: var(--spacing-m);
|
|
129
|
+
max-width: var(--ui3n-notification-width);
|
|
130
|
+
margin-bottom: var(--ui3n-notification-margin-bottom);
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 4px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.withIcon {
|
|
137
|
+
justify-content: flex-start;
|
|
138
|
+
}
|
|
154
139
|
|
|
155
140
|
.ui3nNotificationIcon {
|
|
156
|
-
|
|
141
|
+
position: relative;
|
|
142
|
+
min-width: var(--ui3n-notification-icon-size);
|
|
143
|
+
width: var(--ui3n-notification-icon-size);
|
|
144
|
+
min-height: var(--ui3n-notification-icon-size);
|
|
145
|
+
height: var(--ui3n-notification-icon-size);
|
|
146
|
+
border-radius: 50%;
|
|
147
|
+
display: flex;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
align-items: center;
|
|
157
150
|
}
|
|
158
151
|
|
|
159
152
|
.ui3nNotificationContent {
|
|
160
|
-
|
|
153
|
+
position: relative;
|
|
154
|
+
flex-grow: 2;
|
|
155
|
+
font-size: var(--ui3n-notification-font-size);
|
|
156
|
+
font-weight: 500;
|
|
157
|
+
line-height: 1.33;
|
|
161
158
|
}
|
|
162
|
-
}
|
|
163
159
|
|
|
164
|
-
.
|
|
165
|
-
|
|
160
|
+
.closeBtn {
|
|
161
|
+
position: absolute;
|
|
162
|
+
z-index: 1;
|
|
163
|
+
top: 0;
|
|
164
|
+
right: 0;
|
|
165
|
+
}
|
|
166
166
|
|
|
167
|
-
.
|
|
168
|
-
background-color: var(--
|
|
167
|
+
.infoType {
|
|
168
|
+
background-color: var(--info-fill-default);
|
|
169
|
+
|
|
170
|
+
.ui3nNotificationIcon {
|
|
171
|
+
background-color: var(--info-content-default);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.ui3nNotificationContent {
|
|
175
|
+
color: var(--info-content-default);
|
|
176
|
+
}
|
|
169
177
|
}
|
|
170
178
|
|
|
171
|
-
.
|
|
172
|
-
color: var(--success-
|
|
179
|
+
.successType {
|
|
180
|
+
background-color: var(--success-fill-default);
|
|
181
|
+
|
|
182
|
+
.ui3nNotificationIcon {
|
|
183
|
+
background-color: var(--success-content-default);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ui3nNotificationContent {
|
|
187
|
+
color: var(--success-content-default);
|
|
188
|
+
}
|
|
173
189
|
}
|
|
174
|
-
}
|
|
175
190
|
|
|
176
|
-
.warningType {
|
|
177
|
-
|
|
191
|
+
.warningType {
|
|
192
|
+
background-color: var(--warning-fill-default);
|
|
178
193
|
|
|
179
|
-
|
|
180
|
-
|
|
194
|
+
.ui3nNotificationIcon {
|
|
195
|
+
background-color: var(--warning-content-default);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ui3nNotificationContent {
|
|
199
|
+
color: var(--warning-content-default);
|
|
200
|
+
}
|
|
181
201
|
}
|
|
182
202
|
|
|
183
|
-
.
|
|
184
|
-
color: var(--
|
|
203
|
+
.errorType {
|
|
204
|
+
background-color: var(--error-fill-default);
|
|
205
|
+
|
|
206
|
+
.ui3nNotificationIcon {
|
|
207
|
+
background-color: var(--error-content-default);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ui3nNotificationContent {
|
|
211
|
+
color: var(--error-content-default);
|
|
212
|
+
}
|
|
185
213
|
}
|
|
186
|
-
}
|
|
187
214
|
|
|
188
|
-
.
|
|
189
|
-
|
|
215
|
+
.leftPosition {
|
|
216
|
+
margin-left: 0;
|
|
217
|
+
margin-right: auto;
|
|
218
|
+
}
|
|
190
219
|
|
|
191
|
-
.
|
|
192
|
-
|
|
220
|
+
.centerPosition {
|
|
221
|
+
margin-left: auto;
|
|
222
|
+
margin-right: auto;
|
|
193
223
|
}
|
|
194
224
|
|
|
195
|
-
.
|
|
196
|
-
|
|
225
|
+
.rightPosition {
|
|
226
|
+
margin-left: auto;
|
|
227
|
+
margin-right: 0;
|
|
197
228
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.leftPosition {
|
|
201
|
-
margin-left: 0;
|
|
202
|
-
margin-right: auto;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.centerPosition {
|
|
206
|
-
margin-left: auto;
|
|
207
|
-
margin-right: auto;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.rightPosition {
|
|
211
|
-
margin-left: auto;
|
|
212
|
-
margin-right: 0;
|
|
213
|
-
}
|
|
214
229
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, onBeforeUnmount, ref, useCssModule, watch } from 'vue';
|
|
3
3
|
import toNumber from 'lodash/toNumber';
|
|
4
4
|
import type { Ui3nProgressCircularProps } from './types';
|
|
5
5
|
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
20
20
|
|
|
21
21
|
const innerSize = computed(() => toNumber(props.size));
|
|
22
|
-
const cssSize = computed(() => `${innerSize.value}px`);
|
|
23
22
|
const innerWidth = computed(() => {
|
|
24
23
|
if (props.width) {
|
|
25
24
|
return toNumber(props.width);
|
|
@@ -32,15 +31,24 @@
|
|
|
32
31
|
|
|
33
32
|
return 6 + Math.round(diff / 20);
|
|
34
33
|
});
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
const innerValue = computed(() => toNumber(props.value));
|
|
37
36
|
const fontSize = computed(() => `${Math.floor((innerSize.value - 2 * innerWidth.value) / 3.2)}px`);
|
|
38
37
|
|
|
39
38
|
const circleRadius = computed(() => Math.round(innerSize.value / 2) - Math.round(innerWidth.value / 2));
|
|
40
39
|
const circumference = computed(() => Math.round(Math.PI * 2 * circleRadius.value));
|
|
41
40
|
|
|
42
|
-
const timerId = ref();
|
|
41
|
+
const timerId = ref<ReturnType<typeof setInterval> | null>(null);
|
|
43
42
|
const indeterminateModeValue = ref(0);
|
|
43
|
+
const isInverse = ref(false);
|
|
44
|
+
|
|
45
|
+
const progressStyle = computed(() => ({
|
|
46
|
+
'--ui3n-progress-circular-size': `${innerSize.value}px`,
|
|
47
|
+
'--ui3n-progress-circular-width': `${innerWidth.value}px`,
|
|
48
|
+
'--ui3n-progress-circular-font-size': fontSize.value,
|
|
49
|
+
'--ui3n-progress-circular-bg': props.bgColor,
|
|
50
|
+
'--ui3n-progress-circular-color': props.color,
|
|
51
|
+
}));
|
|
44
52
|
|
|
45
53
|
const strokeDasharray = computed(() => {
|
|
46
54
|
const value = props.indeterminate ? indeterminateModeValue.value : innerValue.value;
|
|
@@ -50,42 +58,58 @@
|
|
|
50
58
|
});
|
|
51
59
|
|
|
52
60
|
function changeValueForIndeterminateMode() {
|
|
61
|
+
if (timerId.value) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
const indeterminateModeValuesLength = indeterminateModeValues.length;
|
|
54
66
|
let index = 0;
|
|
67
|
+
|
|
55
68
|
timerId.value = setInterval(() => {
|
|
56
69
|
indeterminateModeValue.value = indeterminateModeValues[index % indeterminateModeValuesLength];
|
|
57
70
|
index += 1;
|
|
58
71
|
if (index % indeterminateModeValuesLength === 1) {
|
|
59
|
-
|
|
60
|
-
element.value?.classList.remove($style.inverse);
|
|
61
|
-
} else {
|
|
62
|
-
element.value?.classList.add($style.inverse);
|
|
63
|
-
}
|
|
72
|
+
isInverse.value = !isInverse.value;
|
|
64
73
|
}
|
|
65
74
|
}, 200);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
|
|
77
|
+
function clearIndeterminateTimer() {
|
|
78
|
+
if (timerId.value) {
|
|
79
|
+
clearInterval(timerId.value);
|
|
80
|
+
timerId.value = null;
|
|
71
81
|
}
|
|
72
|
-
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
watch(
|
|
85
|
+
() => props.indeterminate,
|
|
86
|
+
isIndeterminate => {
|
|
87
|
+
if (isIndeterminate) {
|
|
88
|
+
changeValueForIndeterminateMode();
|
|
89
|
+
} else {
|
|
90
|
+
clearIndeterminateTimer();
|
|
91
|
+
isInverse.value = false;
|
|
92
|
+
indeterminateModeValue.value = 0;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{ immediate: true },
|
|
96
|
+
);
|
|
73
97
|
|
|
74
98
|
onBeforeUnmount(() => {
|
|
75
|
-
|
|
99
|
+
clearIndeterminateTimer();
|
|
76
100
|
});
|
|
77
101
|
</script>
|
|
78
102
|
|
|
79
103
|
<template>
|
|
80
104
|
<div
|
|
81
105
|
ref="element"
|
|
82
|
-
:
|
|
106
|
+
:style="progressStyle"
|
|
107
|
+
:class="[$style.ui3nProgressCircular, indeterminate && $style.indeterminate, isInverse && $style.inverse]"
|
|
83
108
|
>
|
|
84
109
|
<svg
|
|
85
110
|
:height="innerSize"
|
|
86
111
|
:width="innerSize"
|
|
87
112
|
:class="$style.pie"
|
|
88
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
89
113
|
>
|
|
90
114
|
<circle
|
|
91
115
|
:class="$style.background"
|
|
@@ -114,12 +138,6 @@
|
|
|
114
138
|
|
|
115
139
|
<style lang="scss" module>
|
|
116
140
|
.ui3nProgressCircular {
|
|
117
|
-
--ui3n-progress-circular-size: v-bind(cssSize);
|
|
118
|
-
--ui3n-progress-circular-width: v-bind(cssWidth);
|
|
119
|
-
--ui3n-progress-circular-font-size: v-bind(fontSize);
|
|
120
|
-
--ui3n-progress-circular-bg: v-bind(bgColor);
|
|
121
|
-
--ui3n-progress-circular-color: v-bind(color);
|
|
122
|
-
|
|
123
141
|
position: relative;
|
|
124
142
|
min-width: var(--ui3n-progress-circular-size);
|
|
125
143
|
width: var(--ui3n-progress-circular-size);
|
|
@@ -15,13 +15,22 @@
|
|
|
15
15
|
|
|
16
16
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
17
17
|
const innerHeight = computed(() => toNumber(props.height));
|
|
18
|
-
const cssHeight = computed(() => `${innerHeight.value}px`);
|
|
19
18
|
const innerValue = computed(() => toNumber(props.value));
|
|
20
19
|
const displayValue = computed(() => (props.indeterminate ? `20%` : `${Math.min(innerValue.value, 100)}%`));
|
|
20
|
+
|
|
21
|
+
const progressStyle = computed(() => ({
|
|
22
|
+
'--ui3n-progress-linear-height': `${innerHeight.value}px`,
|
|
23
|
+
'--ui3n-progress-linear-bg': props.bgColor,
|
|
24
|
+
'--ui3n-progress-linear-color': props.color,
|
|
25
|
+
'--ui3n-progress-linear-font-size': `${Math.max(innerHeight.value - 2, 10)}px`,
|
|
26
|
+
}));
|
|
21
27
|
</script>
|
|
22
28
|
|
|
23
29
|
<template>
|
|
24
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
:style="progressStyle"
|
|
32
|
+
:class="[$style.ui3nProgressLinear, indeterminate && $style.indeterminate]"
|
|
33
|
+
>
|
|
25
34
|
<div
|
|
26
35
|
v-if="isValueShown && innerHeight < thresholdHeight"
|
|
27
36
|
:class="[$style.text, $style.above]"
|
|
@@ -47,10 +56,6 @@
|
|
|
47
56
|
|
|
48
57
|
<style lang="scss" module>
|
|
49
58
|
.ui3nProgressLinear {
|
|
50
|
-
--ui3n-progress-linear-height: v-bind(cssHeight);
|
|
51
|
-
--ui3n-progress-linear-bg: v-bind(bgColor);
|
|
52
|
-
--ui3n-progress-linear-color: v-bind(color);
|
|
53
|
-
|
|
54
59
|
position: relative;
|
|
55
60
|
width: 100%;
|
|
56
61
|
}
|
|
@@ -73,10 +78,11 @@
|
|
|
73
78
|
height: var(--ui3n-progress-linear-height);
|
|
74
79
|
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
75
80
|
background-color: var(--ui3n-progress-linear-color);
|
|
81
|
+
transition: width 0.2s ease-in-out;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
.text {
|
|
79
|
-
font-size:
|
|
85
|
+
font-size: var(--ui3n-progress-linear-font-size);
|
|
80
86
|
font-weight: 500;
|
|
81
87
|
line-height: var(--ui3n-progress-linear-height);
|
|
82
88
|
color: var(--ui3n-progress-linear-bg);
|
|
@@ -93,6 +99,7 @@
|
|
|
93
99
|
|
|
94
100
|
.indeterminate {
|
|
95
101
|
.value {
|
|
102
|
+
transition: none;
|
|
96
103
|
animation: 1s linear 0s infinite normal move;
|
|
97
104
|
}
|
|
98
105
|
}
|
|
@@ -9,6 +9,14 @@ export type Ui3nRadioValue = boolean | string | number;
|
|
|
9
9
|
* Radio component properties
|
|
10
10
|
*/
|
|
11
11
|
export interface Ui3nRadioProps {
|
|
12
|
+
/**
|
|
13
|
+
* Root element id
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* HTML name attribute for form submission (used if radio is outside a group)
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
12
20
|
/**
|
|
13
21
|
* Current radio value
|
|
14
22
|
*/
|
|
@@ -50,6 +58,10 @@ export interface Ui3nRadioEmits {
|
|
|
50
58
|
(ev: 'update:modelValue', value: Ui3nRadioValue): void;
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
export interface Ui3nRadioExpose {
|
|
62
|
+
clear: () => void;
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
/**
|
|
54
66
|
* Radio component slots
|
|
55
67
|
*/
|
|
@@ -72,6 +84,10 @@ export interface Ui3nRadioSlots {
|
|
|
72
84
|
* Radio group component properties
|
|
73
85
|
*/
|
|
74
86
|
export interface Ui3nRadioGroupProps {
|
|
87
|
+
/**
|
|
88
|
+
* Root element id
|
|
89
|
+
*/
|
|
90
|
+
id?: string;
|
|
75
91
|
/**
|
|
76
92
|
* Radio group name
|
|
77
93
|
*/
|
|
@@ -115,3 +131,7 @@ export interface Ui3nRadioGroupSlots {
|
|
|
115
131
|
*/
|
|
116
132
|
default: () => VNode;
|
|
117
133
|
}
|
|
134
|
+
|
|
135
|
+
export interface Ui3nRadioGroupExpose {
|
|
136
|
+
clear: () => void;
|
|
137
|
+
}
|