vueless 0.0.316 → 0.0.318
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 +1 -1
- package/ui.button/composables/attrs.composable.js +2 -0
- package/ui.button/configs/default.config.js +1 -1
- package/ui.button/index.vue +13 -9
- package/ui.dropdown-badge/composables/attrs.composable.js +5 -2
- package/ui.dropdown-badge/configs/default.config.js +4 -13
- package/ui.dropdown-badge/index.vue +36 -45
- package/ui.dropdown-button/index.vue +24 -32
- package/ui.dropdown-link/composables/attrs.composable.js +2 -2
- package/ui.dropdown-link/configs/default.config.js +0 -1
- package/ui.dropdown-link/index.vue +71 -77
- package/ui.form-calendar/index.vue +20 -10
- package/ui.text-alert/configs/default.config.js +5 -5
- package/ui.text-alert/index.vue +1 -1
- package/ui.text-badge/composables/attrs.composable.js +6 -1
- package/ui.text-badge/configs/default.config.js +30 -14
- package/ui.text-badge/index.stories.js +0 -3
- package/ui.text-badge/index.vue +73 -25
- package/web-types.json +139 -103
package/package.json
CHANGED
package/ui.button/index.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<template v-if="loading">
|
|
12
12
|
<!-- Label is needed to prevent changing button height -->
|
|
13
13
|
<div tabindex="-1" class="invisible w-0" v-text="label" />
|
|
14
|
-
<ULoader :loading="loading" :size="loaderSize" :color="
|
|
14
|
+
<ULoader :loading="loading" :size="loaderSize" :color="iconColor" v-bind="loaderAttrs" />
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<template v-else>
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
@binding {string} icon-size
|
|
22
22
|
@binding {string} icon-color
|
|
23
23
|
-->
|
|
24
|
-
<slot name="left" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="
|
|
24
|
+
<slot name="left" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="iconColor">
|
|
25
25
|
<UIcon
|
|
26
26
|
v-if="leftIcon"
|
|
27
27
|
internal
|
|
28
28
|
:name="leftIcon"
|
|
29
29
|
:size="iconSize"
|
|
30
|
-
:color="
|
|
30
|
+
:color="iconColor"
|
|
31
31
|
v-bind="leftIconAttrs"
|
|
32
32
|
/>
|
|
33
33
|
</slot>
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
:label="label"
|
|
45
45
|
:icon-name="icon"
|
|
46
46
|
:icon-size="iconSize"
|
|
47
|
-
:icon-color="
|
|
47
|
+
:icon-color="iconColor"
|
|
48
48
|
>
|
|
49
49
|
<UIcon
|
|
50
50
|
v-if="icon"
|
|
51
51
|
internal
|
|
52
52
|
:name="icon"
|
|
53
53
|
:size="iconSize"
|
|
54
|
-
:color="
|
|
54
|
+
:color="iconColor"
|
|
55
55
|
v-bind="centerIconAttrs"
|
|
56
56
|
/>
|
|
57
57
|
<template v-else>
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
@binding {string} icon-size
|
|
66
66
|
@binding {string} icon-color
|
|
67
67
|
-->
|
|
68
|
-
<slot name="right" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="
|
|
68
|
+
<slot name="right" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="iconColor">
|
|
69
69
|
<UIcon
|
|
70
70
|
v-if="rightIcon"
|
|
71
71
|
internal
|
|
72
72
|
:name="rightIcon"
|
|
73
73
|
:size="iconSize"
|
|
74
|
-
:color="
|
|
74
|
+
:color="iconColor"
|
|
75
75
|
v-bind="rightIconAttrs"
|
|
76
76
|
/>
|
|
77
77
|
</slot>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
</template>
|
|
81
81
|
|
|
82
82
|
<script setup>
|
|
83
|
-
import { computed, ref } from "vue";
|
|
83
|
+
import { computed, ref, watchEffect } from "vue";
|
|
84
84
|
|
|
85
85
|
import { getRandomId, getDefault } from "../service.ui";
|
|
86
86
|
import ULoader from "../ui.loader";
|
|
@@ -284,7 +284,11 @@ const iconSize = computed(() => {
|
|
|
284
284
|
return sizes[props.size];
|
|
285
285
|
});
|
|
286
286
|
|
|
287
|
-
const
|
|
287
|
+
const iconColor = computed(() => {
|
|
288
288
|
return props.variant === "primary" ? "white" : props.color;
|
|
289
289
|
});
|
|
290
|
+
|
|
291
|
+
watchEffect(() => {
|
|
292
|
+
props.loading && buttonRef.value.blur();
|
|
293
|
+
});
|
|
290
294
|
</script>
|
|
@@ -28,12 +28,15 @@ export default function useAttrs(props, { isShownOptions }) {
|
|
|
28
28
|
|
|
29
29
|
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
30
30
|
|
|
31
|
-
if (key === "
|
|
31
|
+
if (key === "dropdownBadge") {
|
|
32
32
|
const badgeAttrs = attrs[`${key}Attrs`];
|
|
33
33
|
|
|
34
34
|
attrs[`${key}Attrs`] = computed(() => ({
|
|
35
35
|
...badgeAttrs.value,
|
|
36
|
-
class: cx([
|
|
36
|
+
class: cx([
|
|
37
|
+
badgeAttrs.value.class,
|
|
38
|
+
isShownOptions.value && config.value.dropdownBadgeActive,
|
|
39
|
+
]),
|
|
37
40
|
}));
|
|
38
41
|
}
|
|
39
42
|
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
|
-
dropdownBadge: {
|
|
4
|
-
component: "{UBadge}",
|
|
5
|
-
base: "cursor-pointer",
|
|
6
|
-
variants: {
|
|
7
|
-
size: {
|
|
8
|
-
sm: "pr-1",
|
|
9
|
-
md: "pr-1.5",
|
|
10
|
-
lg: "pr-1.5",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
3
|
+
dropdownBadge: "{UBadge}",
|
|
14
4
|
dropdownBadgeActive: "group",
|
|
15
5
|
dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
16
6
|
dropdownList: {
|
|
17
|
-
|
|
7
|
+
component: "{UDropdownList}",
|
|
8
|
+
base: "w-fit",
|
|
18
9
|
variants: {
|
|
19
10
|
listYPosition: {
|
|
20
11
|
top: "bottom-6 mb-6",
|
|
@@ -29,12 +20,12 @@ export default /*tw*/ {
|
|
|
29
20
|
defaults: {
|
|
30
21
|
color: "brand",
|
|
31
22
|
size: "md",
|
|
32
|
-
weight: "medium",
|
|
33
23
|
variant: "primary",
|
|
34
24
|
labelKey: "label",
|
|
35
25
|
valueKey: "id",
|
|
36
26
|
listYPosition: "bottom",
|
|
37
27
|
listXPosition: "left",
|
|
28
|
+
round: false,
|
|
38
29
|
noIcon: false,
|
|
39
30
|
/* icons */
|
|
40
31
|
dropdownIcon: "keyboard_arrow_down",
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
:label="label"
|
|
6
6
|
:size="size"
|
|
7
7
|
:color="color"
|
|
8
|
-
:weight="weight"
|
|
9
8
|
:variant="variant"
|
|
10
9
|
v-bind="dropdownBadgeAttrs"
|
|
11
|
-
|
|
10
|
+
tabindex="0"
|
|
11
|
+
:data-test="dataTest"
|
|
12
12
|
@click="onClickBadge"
|
|
13
|
+
@keydown.enter="onClickBadge"
|
|
14
|
+
@keydown.space.prevent="onClickBadge"
|
|
13
15
|
>
|
|
14
16
|
<template #left>
|
|
15
17
|
<!--
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
<slot :label="label" :opened="isShownOptions" />
|
|
29
31
|
</template>
|
|
30
32
|
|
|
31
|
-
<template #right>
|
|
33
|
+
<template #right="{ iconColor, iconSize }">
|
|
32
34
|
<!--
|
|
33
35
|
@slot Use it to add something after the label.
|
|
34
36
|
@binding {boolean} isOpened
|
|
@@ -37,11 +39,11 @@
|
|
|
37
39
|
<UIcon
|
|
38
40
|
v-if="!noIcon"
|
|
39
41
|
internal
|
|
40
|
-
:color="
|
|
42
|
+
:color="iconColor"
|
|
41
43
|
:size="iconSize"
|
|
42
44
|
:name="config.defaults.dropdownIcon"
|
|
43
45
|
v-bind="dropdownIconAttrs"
|
|
44
|
-
:data-test="`${dataTest}-
|
|
46
|
+
:data-test="`${dataTest}-dropdown`"
|
|
45
47
|
/>
|
|
46
48
|
</slot>
|
|
47
49
|
</template>
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
</template>
|
|
63
65
|
|
|
64
66
|
<script setup>
|
|
65
|
-
import {
|
|
67
|
+
import { provide, ref, watch } from "vue";
|
|
66
68
|
|
|
67
69
|
import UIcon from "../ui.image-icon";
|
|
68
70
|
import UBadge from "../ui.text-badge";
|
|
@@ -88,6 +90,30 @@ const props = defineProps({
|
|
|
88
90
|
default: "",
|
|
89
91
|
},
|
|
90
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Options list.
|
|
95
|
+
*/
|
|
96
|
+
options: {
|
|
97
|
+
type: Array,
|
|
98
|
+
default: () => [],
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Label key in the item object of options.
|
|
103
|
+
*/
|
|
104
|
+
labelKey: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: getDefault(defaultConfig, UDropdownBadge).labelKey,
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Value key in the item object of options.
|
|
111
|
+
*/
|
|
112
|
+
valueKey: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: getDefault(defaultConfig, UDropdownBadge).valueKey,
|
|
115
|
+
},
|
|
116
|
+
|
|
91
117
|
/**
|
|
92
118
|
* Badge variant.
|
|
93
119
|
* @values primary, secondary, thirdary
|
|
@@ -116,12 +142,11 @@ const props = defineProps({
|
|
|
116
142
|
},
|
|
117
143
|
|
|
118
144
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @values regular, medium, bold
|
|
145
|
+
* Set badge corners rounded.
|
|
121
146
|
*/
|
|
122
|
-
|
|
123
|
-
type:
|
|
124
|
-
default: getDefault(defaultConfig, UDropdownBadge).
|
|
147
|
+
round: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: getDefault(defaultConfig, UDropdownBadge).round,
|
|
125
150
|
},
|
|
126
151
|
|
|
127
152
|
/**
|
|
@@ -132,30 +157,6 @@ const props = defineProps({
|
|
|
132
157
|
default: getDefault(defaultConfig, UDropdownBadge).noIcon,
|
|
133
158
|
},
|
|
134
159
|
|
|
135
|
-
/**
|
|
136
|
-
* Options list.
|
|
137
|
-
*/
|
|
138
|
-
options: {
|
|
139
|
-
type: Array,
|
|
140
|
-
default: () => [],
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Label key in the item object of options.
|
|
145
|
-
*/
|
|
146
|
-
labelKey: {
|
|
147
|
-
type: String,
|
|
148
|
-
default: getDefault(defaultConfig, UDropdownBadge).labelKey,
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Value key in the item object of options.
|
|
153
|
-
*/
|
|
154
|
-
valueKey: {
|
|
155
|
-
type: String,
|
|
156
|
-
default: getDefault(defaultConfig, UDropdownBadge).valueKey,
|
|
157
|
-
},
|
|
158
|
-
|
|
159
160
|
/**
|
|
160
161
|
* The position of dropdown list on the y-axis.
|
|
161
162
|
* @values top, bottom
|
|
@@ -220,16 +221,6 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
|
|
|
220
221
|
},
|
|
221
222
|
);
|
|
222
223
|
|
|
223
|
-
const iconSize = computed(() => {
|
|
224
|
-
const sizes = {
|
|
225
|
-
sm: "2xs",
|
|
226
|
-
md: "xs",
|
|
227
|
-
lg: "sm",
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
return sizes[props.size];
|
|
231
|
-
});
|
|
232
|
-
|
|
233
224
|
watch(selectedItem, () => {
|
|
234
225
|
emit("select", selectedItem.value);
|
|
235
226
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:disabled="disabled"
|
|
12
12
|
:filled="filled || isShownOptions"
|
|
13
13
|
v-bind="dropdownButtonAttrs"
|
|
14
|
-
:data-test="
|
|
14
|
+
:data-test="dataTest"
|
|
15
15
|
@click="onClickButton"
|
|
16
16
|
>
|
|
17
17
|
<template #left>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
:color="iconColor"
|
|
45
45
|
:name="config.defaults.dropdownIcon"
|
|
46
46
|
v-bind="dropdownIconAttrs"
|
|
47
|
-
:data-test="`${dataTest}-
|
|
47
|
+
:data-test="`${dataTest}-dropdown`"
|
|
48
48
|
/>
|
|
49
49
|
</slot>
|
|
50
50
|
</template>
|
|
@@ -85,19 +85,35 @@ defineOptions({ name: "UDropdownButton", inheritAttrs: false });
|
|
|
85
85
|
|
|
86
86
|
const props = defineProps({
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* Button label.
|
|
89
89
|
*/
|
|
90
|
-
|
|
91
|
-
type:
|
|
90
|
+
label: {
|
|
91
|
+
type: String,
|
|
92
92
|
default: "",
|
|
93
93
|
},
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* Options list.
|
|
97
97
|
*/
|
|
98
|
-
|
|
98
|
+
options: {
|
|
99
|
+
type: Array,
|
|
100
|
+
default: () => [],
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Label key in the item object of options.
|
|
105
|
+
*/
|
|
106
|
+
labelKey: {
|
|
99
107
|
type: String,
|
|
100
|
-
default:
|
|
108
|
+
default: getDefault(defaultConfig, UDropdownButton).labelKey,
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Value key in the item object of options.
|
|
113
|
+
*/
|
|
114
|
+
valueKey: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: getDefault(defaultConfig, UDropdownButton).valueKey,
|
|
101
117
|
},
|
|
102
118
|
|
|
103
119
|
/**
|
|
@@ -167,30 +183,6 @@ const props = defineProps({
|
|
|
167
183
|
default: getDefault(defaultConfig, UDropdownButton).noIcon,
|
|
168
184
|
},
|
|
169
185
|
|
|
170
|
-
/**
|
|
171
|
-
* Options list.
|
|
172
|
-
*/
|
|
173
|
-
options: {
|
|
174
|
-
type: Array,
|
|
175
|
-
default: () => [],
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Label key in the item object of options.
|
|
180
|
-
*/
|
|
181
|
-
labelKey: {
|
|
182
|
-
type: String,
|
|
183
|
-
default: getDefault(defaultConfig, UDropdownButton).labelKey,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Value key in the item object of options.
|
|
188
|
-
*/
|
|
189
|
-
valueKey: {
|
|
190
|
-
type: String,
|
|
191
|
-
default: getDefault(defaultConfig, UDropdownButton).valueKey,
|
|
192
|
-
},
|
|
193
|
-
|
|
194
186
|
/**
|
|
195
187
|
* The position of dropdown list on the y-axis.
|
|
196
188
|
* @values top, bottom
|
|
@@ -28,12 +28,12 @@ export default function useAttrs(props, { isShownOptions }) {
|
|
|
28
28
|
|
|
29
29
|
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
30
30
|
|
|
31
|
-
if (key === "
|
|
31
|
+
if (key === "dropdownLink") {
|
|
32
32
|
const linkAttrs = attrs[`${key}Attrs`];
|
|
33
33
|
|
|
34
34
|
attrs[`${key}Attrs`] = computed(() => ({
|
|
35
35
|
...linkAttrs.value,
|
|
36
|
-
class: cx([linkAttrs.value.class, isShownOptions.value && config.value.
|
|
36
|
+
class: cx([linkAttrs.value.class, isShownOptions.value && config.value.dropdownLinkActive]),
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-click-outside="hideOptions" v-bind="wrapperAttrs">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
<ULink
|
|
4
|
+
:id="id"
|
|
5
|
+
:size="size"
|
|
6
|
+
:label="label"
|
|
7
|
+
:color="color"
|
|
8
|
+
:dashed="dashed"
|
|
9
|
+
:no-ring="noRing"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:underlined="underlined"
|
|
12
|
+
v-bind="dropdownLinkAttrs"
|
|
13
|
+
:data-test="dataTest"
|
|
14
|
+
@click="onClickLink"
|
|
15
|
+
@keydown.enter="onClickLink"
|
|
16
|
+
@keydown.space.prevent="onClickLink"
|
|
17
|
+
>
|
|
18
|
+
<template #left>
|
|
19
|
+
<!--
|
|
19
20
|
@slot Use it to add something before the label.
|
|
20
21
|
@binding {boolean} isOpened
|
|
21
22
|
-->
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
<slot name="left" :opened="isShownOptions" />
|
|
24
|
+
</template>
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
<template #default>
|
|
27
|
+
<!--
|
|
27
28
|
@slot Use it to add something instead of the default label.
|
|
28
29
|
@binding {string} label
|
|
29
30
|
@binding {boolean} isOpened
|
|
30
31
|
-->
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
<slot :label="label" />
|
|
33
|
+
</template>
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
<template #right>
|
|
36
|
+
<!--
|
|
36
37
|
@slot Use it to add something after the label.
|
|
37
38
|
@binding {boolean} isOpened
|
|
38
39
|
-->
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</div>
|
|
40
|
+
<slot name="right" :opened="isShownOptions">
|
|
41
|
+
<UIcon
|
|
42
|
+
v-if="!noIcon"
|
|
43
|
+
internal
|
|
44
|
+
interactive
|
|
45
|
+
:color="color"
|
|
46
|
+
:size="iconSize"
|
|
47
|
+
:name="config.defaults.dropdownIcon"
|
|
48
|
+
v-bind="dropdownIconAttrs"
|
|
49
|
+
:data-test="`${dataTest}-dropdown`"
|
|
50
|
+
@click="onClickLink"
|
|
51
|
+
/>
|
|
52
|
+
</slot>
|
|
53
|
+
</template>
|
|
54
|
+
</ULink>
|
|
55
55
|
|
|
56
56
|
<UDropdownList
|
|
57
57
|
v-if="isShownOptions"
|
|
@@ -81,7 +81,6 @@ import vClickOutside from "../directive.clickOutside";
|
|
|
81
81
|
import { UDropdownLink } from "./constants";
|
|
82
82
|
import defaultConfig from "./configs/default.config";
|
|
83
83
|
import useAttrs from "./composables/attrs.composable";
|
|
84
|
-
import { UDropdownButton } from "../ui.dropdown-button/constants/index.js";
|
|
85
84
|
|
|
86
85
|
/* Should be a string for correct web-types gen */
|
|
87
86
|
defineOptions({ name: "UDropdownLink", inheritAttrs: false });
|
|
@@ -95,6 +94,30 @@ const props = defineProps({
|
|
|
95
94
|
default: "",
|
|
96
95
|
},
|
|
97
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Options list.
|
|
99
|
+
*/
|
|
100
|
+
options: {
|
|
101
|
+
type: Array,
|
|
102
|
+
default: () => [],
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Label key in the item object of options.
|
|
107
|
+
*/
|
|
108
|
+
labelKey: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: getDefault(defaultConfig, UDropdownLink).labelKey,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Value key in the item object of options.
|
|
115
|
+
*/
|
|
116
|
+
valueKey: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: getDefault(defaultConfig, UDropdownLink).valueKey,
|
|
119
|
+
},
|
|
120
|
+
|
|
98
121
|
/**
|
|
99
122
|
* Link color.
|
|
100
123
|
* @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
|
|
@@ -153,30 +176,6 @@ const props = defineProps({
|
|
|
153
176
|
default: getDefault(defaultConfig, UDropdownLink).noIcon,
|
|
154
177
|
},
|
|
155
178
|
|
|
156
|
-
/**
|
|
157
|
-
* Options list.
|
|
158
|
-
*/
|
|
159
|
-
options: {
|
|
160
|
-
type: Array,
|
|
161
|
-
default: () => [],
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Label key in the item object of options.
|
|
166
|
-
*/
|
|
167
|
-
labelKey: {
|
|
168
|
-
type: String,
|
|
169
|
-
default: getDefault(defaultConfig, UDropdownButton).labelKey,
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Value key in the item object of options.
|
|
174
|
-
*/
|
|
175
|
-
valueKey: {
|
|
176
|
-
type: String,
|
|
177
|
-
default: getDefault(defaultConfig, UDropdownButton).valueKey,
|
|
178
|
-
},
|
|
179
|
-
|
|
180
179
|
/**
|
|
181
180
|
* The position of dropdown list on the y-axis.
|
|
182
181
|
* @values top, bottom
|
|
@@ -234,21 +233,16 @@ provide("hideDropdownOptions", hideOptions);
|
|
|
234
233
|
const isShownOptions = ref(false);
|
|
235
234
|
const selectedItem = ref("");
|
|
236
235
|
|
|
237
|
-
const {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
dropdownListAttrs,
|
|
242
|
-
dropdownIconAttrs,
|
|
243
|
-
triggerAttrs,
|
|
244
|
-
} = useAttrs(props, { isShownOptions });
|
|
236
|
+
const { config, wrapperAttrs, dropdownLinkAttrs, dropdownListAttrs, dropdownIconAttrs } = useAttrs(
|
|
237
|
+
props,
|
|
238
|
+
{ isShownOptions },
|
|
239
|
+
);
|
|
245
240
|
|
|
246
241
|
const iconSize = computed(() => {
|
|
247
242
|
const sizes = {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
lg: "md",
|
|
243
|
+
sm: "2xs",
|
|
244
|
+
md: "xs",
|
|
245
|
+
lg: "sm",
|
|
252
246
|
};
|
|
253
247
|
|
|
254
248
|
return sizes[props.size];
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
</template>
|
|
141
141
|
|
|
142
142
|
<script setup>
|
|
143
|
-
import { computed,
|
|
143
|
+
import { computed, ref, watch } from "vue";
|
|
144
144
|
import { merge } from "lodash-es";
|
|
145
145
|
|
|
146
146
|
import UButton from "../ui.button";
|
|
@@ -543,16 +543,26 @@ watch(
|
|
|
543
543
|
},
|
|
544
544
|
);
|
|
545
545
|
|
|
546
|
-
|
|
547
|
-
if (selectedDate.value && isTimepickerEnabled.value) {
|
|
548
|
-
hoursRef.value.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
549
|
-
minutesRef.value.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
550
|
-
secondsRef.value.value = String(selectedDate.value.getSeconds()).padStart(2, "0");
|
|
551
|
-
}
|
|
546
|
+
let isInit = false;
|
|
552
547
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
548
|
+
const unwatchInit = watch(
|
|
549
|
+
() => selectedDate.value,
|
|
550
|
+
() => {
|
|
551
|
+
if (isInit) unwatchInit();
|
|
552
|
+
|
|
553
|
+
if (selectedDate.value && isTimepickerEnabled.value) {
|
|
554
|
+
hoursRef.value.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
555
|
+
minutesRef.value.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
556
|
+
secondsRef.value.value = String(selectedDate.value.getSeconds()).padStart(2, "0");
|
|
557
|
+
|
|
558
|
+
emit("formattedDateChange", userFormattedDate.value);
|
|
559
|
+
emit("userDateChange", userFormattedDate.value);
|
|
560
|
+
|
|
561
|
+
isInit = true;
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
{ deep: true },
|
|
565
|
+
);
|
|
556
566
|
|
|
557
567
|
function getCurrentValueType(value) {
|
|
558
568
|
if (props.range && value === null) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: {
|
|
3
|
-
base: "p-4 flex flex-col rounded-dynamic",
|
|
3
|
+
base: "border p-4 flex flex-col rounded-dynamic",
|
|
4
4
|
variants: {
|
|
5
5
|
variant: {
|
|
6
|
-
primary: "bg-{color}-600 text-white",
|
|
7
|
-
secondary: "
|
|
8
|
-
thirdary: "bg-{color}-50 text-{color}-600",
|
|
6
|
+
primary: "bg-{color}-600 text-white border-transparent",
|
|
7
|
+
secondary: "border-{color}-600 text-{color}-600",
|
|
8
|
+
thirdary: "bg-{color}-50 text-{color}-600 border-transparent",
|
|
9
9
|
},
|
|
10
10
|
size: {
|
|
11
11
|
xs: "text-2xs",
|
|
@@ -15,7 +15,7 @@ export default /*tw*/ {
|
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
compoundVariants: [
|
|
18
|
-
{ variant: "thirdary", bordered: true, class: "border
|
|
18
|
+
{ variant: "thirdary", bordered: true, class: "border-{color}-100" },
|
|
19
19
|
{ color: "white", variant: "primary", class: "text-gray-900 bg-white" },
|
|
20
20
|
{ color: "white", variant: "secondary", class: "text-gray-900 border-gray-200" },
|
|
21
21
|
{ color: "white", variant: "thirdary", class: "text-gray-900 bg-white" },
|