@v1nt1248/3nclient-lib 0.3.30 → 0.3.32
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 → ui3n-notification-DPC5Ke4b.js} +96 -97
- package/dist/components/index.d.ts +3 -3
- package/dist/components/ui3n-breadcrumbs/types.d.ts +2 -0
- package/dist/components/ui3n-dialog/types.d.ts +1 -1
- package/dist/components/ui3n-editable/types.d.ts +1 -1
- package/dist/components/ui3n-editable/ui3n-editable.d.ts +1 -1
- package/dist/components/ui3n-editable/useContentEditable.d.ts +1 -1
- package/dist/components/ui3n-input/types.d.ts +2 -2
- package/dist/components/ui3n-menu/types.d.ts +16 -1
- package/dist/components/ui3n-menu/ui3n-menu.d.ts +2 -0
- package/dist/components/ui3n-mobile-menu/ui3n-mobile-menu.d.ts +2 -2
- package/dist/components/ui3n-notification/types.d.ts +0 -4
- package/dist/components/ui3n-notification/ui3n-notification-container.d.ts +11 -0
- package/dist/components/ui3n-notification/ui3n-notification.d.ts +1 -1
- package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +3 -3
- package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +2 -0
- package/dist/components/ui3n-selector/types.d.ts +1 -11
- package/dist/components/ui3n-step-line-bar/ui3n-step-line-bar.d.ts +1 -0
- package/dist/components/ui3n-switch/ui3n-switch.d.ts +2 -6
- package/dist/components/ui3n-table/composables/useTable.d.ts +4 -3
- package/dist/components/ui3n-text/ui3n-text.d.ts +1 -0
- package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/plugins/dialogs/dialogs.d.ts +2 -2
- package/dist/plugins/dialogs/store-dialog.d.ts +2 -2
- package/dist/plugins/dialogs/types.d.ts +1 -1
- package/dist/plugins/notifications/store-notifications.d.ts +1 -1
- package/dist/plugins/notifications/types.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/ui3n-components.d.ts +1 -1
- package/dist/ui3n-components.js +1402 -1392
- package/dist/ui3n-plugins.d.ts +5 -5
- package/dist/ui3n-plugins.js +56 -43
- package/dist/utils/files/create-video-thumbnail.d.ts +1 -1
- package/dist/utils/for-vue/try-on-scope-dispose.d.ts +1 -1
- package/dist/utils/for-vue/unref-element.d.ts +1 -1
- package/dist/utils/processes/scheduler-yield.d.ts +1 -1
- package/dist/utils/processes/task-runner.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/index.ts +9 -2
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +2 -1
- package/src/components/ui3n-breadcrumbs/types.ts +2 -0
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +45 -35
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +12 -1
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +33 -67
- package/src/components/ui3n-editable/ui3n-editable.vue +68 -46
- package/src/components/ui3n-emoji/ui3n-emoji.vue +21 -27
- package/src/components/ui3n-icon/ui3n-icon.vue +13 -5
- package/src/components/ui3n-input/types.ts +2 -2
- package/src/components/ui3n-input/ui3n-input.vue +15 -9
- package/src/components/ui3n-menu/types.ts +19 -1
- package/src/components/ui3n-menu/ui3n-menu.vue +60 -57
- package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +87 -38
- package/src/components/ui3n-notification/types.ts +0 -4
- package/src/components/ui3n-notification/ui3n-notification-container.vue +62 -0
- package/src/components/ui3n-notification/ui3n-notification.vue +74 -70
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +80 -120
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +32 -15
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +2 -1
- package/src/components/ui3n-radio-group/ui3n-radio.vue +38 -47
- package/src/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.vue → ui3n-scrollbar-horizontal.vue} +6 -8
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +10 -6
- package/src/components/ui3n-selector/types.ts +1 -10
- package/src/components/ui3n-selector/ui3n-selector.vue +49 -47
- package/src/components/ui3n-slider/ui3n-slider.vue +6 -9
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +5 -1
- package/src/components/ui3n-switch/ui3n-switch.vue +24 -19
- package/src/components/ui3n-table/composables/useTable.ts +37 -22
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +6 -1
- package/src/components/ui3n-table/ui3n-table.vue +3 -1
- package/src/components/ui3n-tabs/ui3n-tabs.vue +0 -23
- package/src/components/ui3n-text/ui3n-text.vue +36 -8
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +39 -18
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +2 -2
- /package/dist/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.d.ts → ui3n-scrollbar-horizontal.d.ts} +0 -0
|
@@ -1,129 +1,76 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed
|
|
3
|
-
import toNumber from 'lodash/toNumber';
|
|
2
|
+
import { computed } from 'vue';
|
|
4
3
|
import type { Ui3nProgressCircularProps } from './types';
|
|
5
4
|
|
|
6
|
-
const thresholdSize = 64;
|
|
7
|
-
const indeterminateModeValues = [1, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 85, 90, 95, 99];
|
|
8
|
-
|
|
9
5
|
const props = withDefaults(defineProps<Ui3nProgressCircularProps>(), {
|
|
10
6
|
value: 0,
|
|
11
7
|
size: 64,
|
|
12
8
|
bgColor: 'var(--color-bg-control-primary-default)',
|
|
13
9
|
color: 'var(--color-bg-control-accent-default)',
|
|
10
|
+
indeterminate: false,
|
|
11
|
+
withText: false,
|
|
14
12
|
});
|
|
15
13
|
|
|
16
|
-
const
|
|
14
|
+
const parseToNumber = (val: number | string): number => {
|
|
15
|
+
const num = parseFloat(String(val));
|
|
16
|
+
return isNaN(num) ? 0 : num;
|
|
17
|
+
};
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const innerSize = computed(() => parseToNumber(props.size) || 64);
|
|
20
|
+
const innerValue = computed(() => Math.min(Math.max(parseToNumber(props.value), 0), 100));
|
|
19
21
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
20
22
|
|
|
21
|
-
const
|
|
22
|
-
const innerWidth = computed(() => {
|
|
23
|
+
const virtualStrokeWidth = computed(() => {
|
|
23
24
|
if (props.width) {
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const diff = innerSize.value - thresholdSize;
|
|
28
|
-
if (diff <= 0) {
|
|
29
|
-
return Math.round(innerSize.value / 10);
|
|
25
|
+
return (parseToNumber(props.width) / innerSize.value) * 100;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
|
-
return 6 + Math.round(diff / 20);
|
|
27
|
+
return 8;
|
|
33
28
|
});
|
|
34
29
|
|
|
35
|
-
const
|
|
36
|
-
const
|
|
30
|
+
const virtualRadius = computed(() => (100 - virtualStrokeWidth.value) / 2);
|
|
31
|
+
const virtualCircumference = computed(() => Math.round(Math.PI * 2 * virtualRadius.value));
|
|
37
32
|
|
|
38
|
-
const
|
|
39
|
-
|
|
33
|
+
const strokeDasharray = computed(() => {
|
|
34
|
+
const dash = Math.round((virtualCircumference.value * innerValue.value) / 100);
|
|
35
|
+
const gap = virtualCircumference.value - dash;
|
|
36
|
+
return `${dash} ${gap}`;
|
|
37
|
+
});
|
|
40
38
|
|
|
41
|
-
const
|
|
42
|
-
const indeterminateModeValue = ref(0);
|
|
43
|
-
const isInverse = ref(false);
|
|
39
|
+
const fontSize = computed(() => `${Math.floor(innerSize.value / 3.8)}px`);
|
|
44
40
|
|
|
45
41
|
const progressStyle = computed(() => ({
|
|
46
42
|
'--ui3n-progress-circular-size': `${innerSize.value}px`,
|
|
47
|
-
'--ui3n-progress-circular-width': `${innerWidth.value}px`,
|
|
48
43
|
'--ui3n-progress-circular-font-size': fontSize.value,
|
|
49
44
|
'--ui3n-progress-circular-bg': props.bgColor,
|
|
50
45
|
'--ui3n-progress-circular-color': props.color,
|
|
46
|
+
'--ui3n-progress-virtual-width': String(virtualStrokeWidth.value),
|
|
51
47
|
}));
|
|
52
|
-
|
|
53
|
-
const strokeDasharray = computed(() => {
|
|
54
|
-
const value = props.indeterminate ? indeterminateModeValue.value : innerValue.value;
|
|
55
|
-
const dash = Math.round((circumference.value * value!) / 100);
|
|
56
|
-
const gap = circumference.value - dash;
|
|
57
|
-
return `${dash} ${gap}`;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
function changeValueForIndeterminateMode() {
|
|
61
|
-
if (timerId.value) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const indeterminateModeValuesLength = indeterminateModeValues.length;
|
|
66
|
-
let index = 0;
|
|
67
|
-
|
|
68
|
-
timerId.value = setInterval(() => {
|
|
69
|
-
indeterminateModeValue.value = indeterminateModeValues[index % indeterminateModeValuesLength];
|
|
70
|
-
index += 1;
|
|
71
|
-
if (index % indeterminateModeValuesLength === 1) {
|
|
72
|
-
isInverse.value = !isInverse.value;
|
|
73
|
-
}
|
|
74
|
-
}, 200);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function clearIndeterminateTimer() {
|
|
78
|
-
if (timerId.value) {
|
|
79
|
-
clearInterval(timerId.value);
|
|
80
|
-
timerId.value = null;
|
|
81
|
-
}
|
|
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
|
-
);
|
|
97
|
-
|
|
98
|
-
onBeforeUnmount(() => {
|
|
99
|
-
clearIndeterminateTimer();
|
|
100
|
-
});
|
|
101
48
|
</script>
|
|
102
49
|
|
|
103
50
|
<template>
|
|
104
51
|
<div
|
|
105
|
-
ref="element"
|
|
106
52
|
:style="progressStyle"
|
|
107
|
-
:class="[$style.ui3nProgressCircular, indeterminate && $style.indeterminate
|
|
53
|
+
:class="[$style.ui3nProgressCircular, indeterminate && $style.indeterminate]"
|
|
108
54
|
>
|
|
109
55
|
<svg
|
|
110
56
|
:height="innerSize"
|
|
111
57
|
:width="innerSize"
|
|
58
|
+
viewBox="0 0 100 100"
|
|
112
59
|
:class="$style.pie"
|
|
113
60
|
>
|
|
114
61
|
<circle
|
|
115
62
|
:class="$style.background"
|
|
116
|
-
:r="
|
|
117
|
-
cx="50
|
|
118
|
-
cy="50
|
|
63
|
+
:r="virtualRadius"
|
|
64
|
+
cx="50"
|
|
65
|
+
cy="50"
|
|
119
66
|
/>
|
|
120
67
|
|
|
121
68
|
<circle
|
|
122
69
|
:class="$style.chart"
|
|
123
|
-
:r="
|
|
124
|
-
cx="50
|
|
125
|
-
cy="50
|
|
126
|
-
:stroke-dasharray="strokeDasharray"
|
|
70
|
+
:r="virtualRadius"
|
|
71
|
+
cx="50"
|
|
72
|
+
cy="50"
|
|
73
|
+
:stroke-dasharray="indeterminate ? undefined : strokeDasharray"
|
|
127
74
|
/>
|
|
128
75
|
</svg>
|
|
129
76
|
|
|
@@ -139,80 +86,93 @@
|
|
|
139
86
|
<style lang="scss" module>
|
|
140
87
|
.ui3nProgressCircular {
|
|
141
88
|
position: relative;
|
|
89
|
+
display: inline-flex;
|
|
142
90
|
min-width: var(--ui3n-progress-circular-size);
|
|
143
91
|
width: var(--ui3n-progress-circular-size);
|
|
144
92
|
min-height: var(--ui3n-progress-circular-size);
|
|
145
93
|
height: var(--ui3n-progress-circular-size);
|
|
146
|
-
border-radius: 50%;
|
|
147
|
-
display: flex;
|
|
148
94
|
justify-content: center;
|
|
149
95
|
align-items: center;
|
|
150
|
-
|
|
151
|
-
&.inverse {
|
|
152
|
-
.background {
|
|
153
|
-
stroke: var(--ui3n-progress-circular-color) !important;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.chart {
|
|
157
|
-
stroke: var(--ui3n-progress-circular-bg) !important;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&:not(.indeterminate) {
|
|
162
|
-
.chart {
|
|
163
|
-
transition: 0.2s ease-in-out all;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
96
|
+
user-select: none;
|
|
166
97
|
}
|
|
167
98
|
|
|
168
99
|
.pie {
|
|
169
|
-
min-width: var(--ui3n-progress-circular-size);
|
|
170
|
-
width: var(--ui3n-progress-circular-size);
|
|
171
|
-
min-height: var(--ui3n-progress-circular-size);
|
|
172
|
-
height: var(--ui3n-progress-circular-size);
|
|
173
|
-
border-radius: 50%;
|
|
174
100
|
transform: rotate(-90deg);
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: 100%;
|
|
175
103
|
}
|
|
176
104
|
|
|
177
105
|
.background {
|
|
178
106
|
fill: none;
|
|
179
107
|
stroke: var(--ui3n-progress-circular-bg);
|
|
180
|
-
stroke-width: var(--ui3n-progress-
|
|
108
|
+
stroke-width: var(--ui3n-progress-virtual-width);
|
|
109
|
+
transition: stroke 0.2s ease;
|
|
181
110
|
}
|
|
182
111
|
|
|
183
112
|
.chart {
|
|
184
113
|
fill: none;
|
|
185
114
|
stroke: var(--ui3n-progress-circular-color);
|
|
186
|
-
stroke-width: var(--ui3n-progress-
|
|
115
|
+
stroke-width: var(--ui3n-progress-virtual-width);
|
|
116
|
+
transition:
|
|
117
|
+
stroke-dasharray 0.2s ease-in-out,
|
|
118
|
+
stroke 0.2s ease;
|
|
187
119
|
}
|
|
188
120
|
|
|
189
121
|
.text {
|
|
190
122
|
position: absolute;
|
|
191
|
-
|
|
192
|
-
left: 0;
|
|
193
|
-
width: 100%;
|
|
194
|
-
height: 100%;
|
|
123
|
+
inset: 0;
|
|
195
124
|
display: flex;
|
|
196
125
|
justify-content: center;
|
|
197
126
|
align-items: center;
|
|
198
127
|
font-size: var(--ui3n-progress-circular-font-size);
|
|
199
|
-
font-weight:
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
line-height: 1;
|
|
200
130
|
color: var(--ui3n-progress-circular-color);
|
|
201
131
|
}
|
|
202
132
|
|
|
203
133
|
.indeterminate {
|
|
204
|
-
|
|
205
|
-
|
|
134
|
+
animation: circular-spin 2s linear infinite;
|
|
135
|
+
|
|
136
|
+
.chart {
|
|
137
|
+
stroke-linecap: round;
|
|
138
|
+
animation: circular-dash 1.5s cubic-bezier(0.42, 0, 0.58, 1) infinite;
|
|
206
139
|
}
|
|
207
140
|
}
|
|
208
141
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
142
|
+
:global {
|
|
143
|
+
@keyframes circular-spin {
|
|
144
|
+
0% {
|
|
145
|
+
transform: rotate(0deg);
|
|
146
|
+
}
|
|
147
|
+
100% {
|
|
148
|
+
transform: rotate(360deg);
|
|
149
|
+
}
|
|
212
150
|
}
|
|
213
151
|
|
|
214
|
-
|
|
215
|
-
|
|
152
|
+
:global {
|
|
153
|
+
@keyframes circular-spin {
|
|
154
|
+
0% {
|
|
155
|
+
transform: rotate(0deg);
|
|
156
|
+
}
|
|
157
|
+
100% {
|
|
158
|
+
transform: rotate(360deg);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@keyframes circular-dash {
|
|
163
|
+
0% {
|
|
164
|
+
stroke-dasharray: 1 289;
|
|
165
|
+
stroke-dashoffset: 0;
|
|
166
|
+
}
|
|
167
|
+
50% {
|
|
168
|
+
stroke-dasharray: 216 289;
|
|
169
|
+
stroke-dashoffset: -35;
|
|
170
|
+
}
|
|
171
|
+
100% {
|
|
172
|
+
stroke-dasharray: 1 289;
|
|
173
|
+
stroke-dashoffset: -289;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
216
176
|
}
|
|
217
177
|
}
|
|
218
178
|
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed } from 'vue';
|
|
3
|
-
import toNumber from 'lodash/toNumber';
|
|
4
3
|
import type { Ui3nProgressLinearProps } from './types';
|
|
5
4
|
|
|
6
5
|
const thresholdHeight = 12;
|
|
@@ -11,12 +10,23 @@
|
|
|
11
10
|
height: 2,
|
|
12
11
|
bgColor: 'var(--color-bg-control-primary-default)',
|
|
13
12
|
color: 'var(--color-bg-control-accent-default)',
|
|
13
|
+
indeterminate: false,
|
|
14
|
+
withText: false,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const parseToNumber = (val: number | string): number => {
|
|
18
|
+
const num = parseFloat(String(val));
|
|
19
|
+
return isNaN(num) ? 0 : num;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const innerHeight = computed(() => parseToNumber(props.height));
|
|
23
|
+
const innerValue = computed(() => {
|
|
24
|
+
const val = parseToNumber(props.value);
|
|
25
|
+
return Math.min(Math.max(val, 0), 100);
|
|
14
26
|
});
|
|
15
27
|
|
|
16
28
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
17
|
-
const
|
|
18
|
-
const innerValue = computed(() => toNumber(props.value));
|
|
19
|
-
const displayValue = computed(() => (props.indeterminate ? `20%` : `${Math.min(innerValue.value, 100)}%`));
|
|
29
|
+
const displayValue = computed(() => `${innerValue.value}%`);
|
|
20
30
|
|
|
21
31
|
const progressStyle = computed(() => ({
|
|
22
32
|
'--ui3n-progress-linear-height': `${innerHeight.value}px`,
|
|
@@ -41,7 +51,7 @@
|
|
|
41
51
|
<div :class="$style.body">
|
|
42
52
|
<div
|
|
43
53
|
:class="$style.value"
|
|
44
|
-
:style="{ width: displayValue }"
|
|
54
|
+
:style="indeterminate ? undefined : { width: displayValue }"
|
|
45
55
|
>
|
|
46
56
|
<div
|
|
47
57
|
v-if="isValueShown && innerHeight >= thresholdHeight && innerValue >= thresholdValue"
|
|
@@ -58,6 +68,7 @@
|
|
|
58
68
|
.ui3nProgressLinear {
|
|
59
69
|
position: relative;
|
|
60
70
|
width: 100%;
|
|
71
|
+
user-select: none;
|
|
61
72
|
}
|
|
62
73
|
|
|
63
74
|
.body {
|
|
@@ -66,7 +77,7 @@
|
|
|
66
77
|
height: var(--ui3n-progress-linear-height);
|
|
67
78
|
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
68
79
|
background-color: var(--ui3n-progress-linear-bg);
|
|
69
|
-
overflow
|
|
80
|
+
overflow: hidden;
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
.value {
|
|
@@ -75,7 +86,8 @@
|
|
|
75
86
|
align-items: center;
|
|
76
87
|
position: absolute;
|
|
77
88
|
left: 0;
|
|
78
|
-
|
|
89
|
+
top: 0;
|
|
90
|
+
height: 100%;
|
|
79
91
|
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
80
92
|
background-color: var(--ui3n-progress-linear-color);
|
|
81
93
|
transition: width 0.2s ease-in-out;
|
|
@@ -83,9 +95,10 @@
|
|
|
83
95
|
|
|
84
96
|
.text {
|
|
85
97
|
font-size: var(--ui3n-progress-linear-font-size);
|
|
86
|
-
font-weight:
|
|
98
|
+
font-weight: 600;
|
|
87
99
|
line-height: var(--ui3n-progress-linear-height);
|
|
88
100
|
color: var(--ui3n-progress-linear-bg);
|
|
101
|
+
white-space: nowrap;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
.above {
|
|
@@ -95,22 +108,26 @@
|
|
|
95
108
|
font-size: var(--font-14);
|
|
96
109
|
line-height: var(--font-16);
|
|
97
110
|
color: var(--color-bg-control-accent-default);
|
|
111
|
+
margin-bottom: 4px;
|
|
98
112
|
}
|
|
99
113
|
|
|
100
114
|
.indeterminate {
|
|
101
115
|
.value {
|
|
102
116
|
transition: none;
|
|
103
|
-
|
|
117
|
+
width: 25%;
|
|
118
|
+
left: 0;
|
|
119
|
+
top: 0;
|
|
120
|
+
height: 100%;
|
|
121
|
+
animation: linear-fly 1.4s linear infinite;
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
|
|
107
|
-
@keyframes
|
|
108
|
-
|
|
109
|
-
|
|
125
|
+
@keyframes linear-fly {
|
|
126
|
+
0% {
|
|
127
|
+
transform: translateX(-105%);
|
|
110
128
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
left: 122%;
|
|
129
|
+
100% {
|
|
130
|
+
transform: translateX(405%);
|
|
114
131
|
}
|
|
115
132
|
}
|
|
116
133
|
</style>
|
|
@@ -17,27 +17,25 @@
|
|
|
17
17
|
|
|
18
18
|
const slots = useSlots();
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const isOn = computed(() => val.value === props.checkedValue);
|
|
20
|
+
const groupContext = inject<{
|
|
21
|
+
groupValue: ComputedRef<Ui3nRadioValue>;
|
|
22
|
+
groupName: ComputedRef<string>;
|
|
23
|
+
updateGroupValue: (value: Ui3nRadioValue) => void;
|
|
24
|
+
} | null>('ui3n-radio-group-context', null);
|
|
25
|
+
|
|
26
|
+
const isComponentPartOfGroup = computed(() => groupContext !== null);
|
|
27
|
+
const finalGroupName = computed(() => (groupContext ? groupContext.groupName.value : props.name || ''));
|
|
28
|
+
|
|
29
|
+
const val = ref<Ui3nRadioValue>(
|
|
30
|
+
isComponentPartOfGroup.value && groupContext ? groupContext.groupValue.value : props.modelValue,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const isOn = computed(() => {
|
|
34
|
+
if (isComponentPartOfGroup.value && groupContext) {
|
|
35
|
+
return groupContext.groupValue.value === props.checkedValue;
|
|
36
|
+
}
|
|
37
|
+
return val.value === props.checkedValue;
|
|
38
|
+
});
|
|
41
39
|
|
|
42
40
|
const radioStyle = computed(() => ({
|
|
43
41
|
'--ui3n-radio-size': `${props.size}px`,
|
|
@@ -46,8 +44,11 @@
|
|
|
46
44
|
|
|
47
45
|
function change(ev: Event) {
|
|
48
46
|
ev.preventDefault();
|
|
47
|
+
if (props.disabled) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
49
50
|
|
|
50
|
-
if (!
|
|
51
|
+
if (!isComponentPartOfGroup.value) {
|
|
51
52
|
val.value = isOn.value ? props.uncheckedValue : props.checkedValue;
|
|
52
53
|
emits('change', val.value);
|
|
53
54
|
emits('update:modelValue', val.value);
|
|
@@ -58,13 +59,14 @@
|
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
if (groupContext) {
|
|
63
|
+
groupContext.updateGroupValue(props.checkedValue);
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
function clear() {
|
|
66
68
|
val.value = props.uncheckedValue;
|
|
67
|
-
if (!
|
|
69
|
+
if (!isComponentPartOfGroup.value) {
|
|
68
70
|
emits('change', val.value);
|
|
69
71
|
emits('update:modelValue', val.value);
|
|
70
72
|
}
|
|
@@ -74,26 +76,24 @@
|
|
|
74
76
|
clear,
|
|
75
77
|
});
|
|
76
78
|
|
|
79
|
+
onBeforeMount(() => {
|
|
80
|
+
const hasChecked = !!slots['checkedIcon'];
|
|
81
|
+
const hasUnchecked = !!slots['uncheckedIcon'];
|
|
82
|
+
|
|
83
|
+
if ((hasChecked && !hasUnchecked) || (!hasChecked && hasUnchecked)) {
|
|
84
|
+
throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values defined.');
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
77
88
|
watch(
|
|
78
89
|
() => props.name,
|
|
79
90
|
newName => {
|
|
80
|
-
if (!newName && !
|
|
91
|
+
if (!newName && !isComponentPartOfGroup.value) {
|
|
81
92
|
clear();
|
|
82
93
|
}
|
|
83
94
|
},
|
|
84
95
|
);
|
|
85
96
|
|
|
86
|
-
onBeforeMount(() => {
|
|
87
|
-
if (
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
(slots.checkedIcon && !slots.uncheckedIcon) ||
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
(!slots.checkedIcon && slots.uncheckedIcon)
|
|
92
|
-
) {
|
|
93
|
-
throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values defined.');
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
97
|
watch(
|
|
98
98
|
() => props.modelValue,
|
|
99
99
|
newValue => {
|
|
@@ -102,15 +102,6 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
);
|
|
105
|
-
|
|
106
|
-
watch(
|
|
107
|
-
() => groupValue?.value,
|
|
108
|
-
newVal => {
|
|
109
|
-
if (groupName) {
|
|
110
|
-
val.value = newVal === props.checkedValue ? props.checkedValue : props.uncheckedValue;
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
);
|
|
114
105
|
</script>
|
|
115
106
|
|
|
116
107
|
<template>
|
|
@@ -122,7 +113,7 @@
|
|
|
122
113
|
<input
|
|
123
114
|
type="radio"
|
|
124
115
|
hidden
|
|
125
|
-
:name="
|
|
116
|
+
:name="finalGroupName"
|
|
126
117
|
:checked="isOn"
|
|
127
118
|
:value="String(checkedValue)"
|
|
128
119
|
:disabled="disabled"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
const isScrollingNow = ref(false);
|
|
38
38
|
|
|
39
39
|
let resizeObserver: ResizeObserver | null = null;
|
|
40
|
-
let scrollTimeout:
|
|
40
|
+
let scrollTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
41
41
|
let startX = 0;
|
|
42
42
|
let startScrollLeft = 0;
|
|
43
43
|
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
isScrollingNow.value = true;
|
|
117
|
-
|
|
117
|
+
clearTimeout(scrollTimeout);
|
|
118
118
|
|
|
119
|
-
scrollTimeout =
|
|
119
|
+
scrollTimeout = setTimeout(() => {
|
|
120
120
|
isScrollingNow.value = false;
|
|
121
121
|
}, 1500);
|
|
122
122
|
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
|
|
211
211
|
onBeforeUnmount(() => {
|
|
212
212
|
resizeObserver?.disconnect();
|
|
213
|
-
|
|
213
|
+
scrollTimeout && clearTimeout(scrollTimeout);
|
|
214
214
|
|
|
215
215
|
if (thumbRef.value) {
|
|
216
216
|
thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
|
|
@@ -273,16 +273,14 @@
|
|
|
273
273
|
.ui3nScrollbarHorizontal {
|
|
274
274
|
position: relative;
|
|
275
275
|
width: 100%;
|
|
276
|
-
|
|
277
|
-
overflow: hidden;
|
|
276
|
+
overflow: visible;
|
|
278
277
|
}
|
|
279
278
|
|
|
280
279
|
.scrollbarContainer {
|
|
281
280
|
position: relative;
|
|
282
281
|
width: 100%;
|
|
283
|
-
height: 100%;
|
|
284
282
|
overflow-x: auto;
|
|
285
|
-
overflow-y:
|
|
283
|
+
overflow-y: visible;
|
|
286
284
|
scrollbar-width: none;
|
|
287
285
|
|
|
288
286
|
&::-webkit-scrollbar {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
const isScrollingNow = ref(false);
|
|
38
38
|
|
|
39
39
|
let resizeObserver: ResizeObserver | null = null;
|
|
40
|
-
let scrollTimeout:
|
|
40
|
+
let scrollTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
41
41
|
let startY = 0;
|
|
42
42
|
let startScrollTop = 0;
|
|
43
43
|
|
|
@@ -113,9 +113,9 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
isScrollingNow.value = true;
|
|
116
|
-
|
|
116
|
+
scrollTimeout && clearTimeout(scrollTimeout);
|
|
117
117
|
|
|
118
|
-
scrollTimeout =
|
|
118
|
+
scrollTimeout = setTimeout(() => {
|
|
119
119
|
isScrollingNow.value = false;
|
|
120
120
|
}, 1500);
|
|
121
121
|
|
|
@@ -146,7 +146,9 @@
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
e.
|
|
149
|
+
if (e.pointerType === 'mouse') {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
}
|
|
150
152
|
e.stopPropagation();
|
|
151
153
|
|
|
152
154
|
thumbRef.value.setPointerCapture(e.pointerId);
|
|
@@ -209,7 +211,7 @@
|
|
|
209
211
|
|
|
210
212
|
onBeforeUnmount(() => {
|
|
211
213
|
resizeObserver?.disconnect();
|
|
212
|
-
|
|
214
|
+
scrollTimeout && clearTimeout(scrollTimeout);
|
|
213
215
|
|
|
214
216
|
if (thumbRef.value) {
|
|
215
217
|
thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
|
|
@@ -275,7 +277,8 @@
|
|
|
275
277
|
position: relative;
|
|
276
278
|
width: 100%;
|
|
277
279
|
height: 100%;
|
|
278
|
-
overflow:
|
|
280
|
+
overflow-x: visible;
|
|
281
|
+
overflow-y: hidden;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
284
|
.scrollbarContainer {
|
|
@@ -283,6 +286,7 @@
|
|
|
283
286
|
width: 100%;
|
|
284
287
|
height: 100%;
|
|
285
288
|
overflow-y: auto;
|
|
289
|
+
overflow-x: visible;
|
|
286
290
|
scrollbar-width: none;
|
|
287
291
|
|
|
288
292
|
&::-webkit-scrollbar {
|
|
@@ -59,10 +59,6 @@ export interface Ui3nSelectorProps<T extends Ui3nSelectorOptionBase> {
|
|
|
59
59
|
* Property or function to display item
|
|
60
60
|
*/
|
|
61
61
|
itemDisplay?: keyof T | Ui3nSelectorItemDisplayingFunction<T>;
|
|
62
|
-
/**
|
|
63
|
-
* Custom filter function
|
|
64
|
-
*/
|
|
65
|
-
customFilter?: (value: Ui3nSelectorValue<T>, query: string) => boolean;
|
|
66
62
|
/**
|
|
67
63
|
* Whether to return the whole object or just the value
|
|
68
64
|
* @default false
|
|
@@ -73,11 +69,6 @@ export interface Ui3nSelectorProps<T extends Ui3nSelectorOptionBase> {
|
|
|
73
69
|
* @default false
|
|
74
70
|
*/
|
|
75
71
|
clearable?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Whether to show search input
|
|
78
|
-
* @default false
|
|
79
|
-
*/
|
|
80
|
-
withSearch?: boolean;
|
|
81
72
|
/**
|
|
82
73
|
* Whether to hide selected item
|
|
83
74
|
* @default false
|
|
@@ -149,7 +140,7 @@ export interface Ui3nSelectorSlots<T extends Ui3nSelectorOptionBase> {
|
|
|
149
140
|
/**
|
|
150
141
|
* Item slot
|
|
151
142
|
*/
|
|
152
|
-
item?: (props: { item: T; index: number; activeIndex: Nullable<number
|
|
143
|
+
item?: (props: { item: T; index: number; activeIndex: Nullable<number> }) => VNode;
|
|
153
144
|
/**
|
|
154
145
|
* Selection slot
|
|
155
146
|
*/
|