@tak-ps/vue-tabler 3.76.0 → 3.78.0
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/CHANGELOG.md +8 -0
- package/components/Button.vue +7 -0
- package/components/Dropdown.vue +47 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v3.78.0
|
|
14
|
+
|
|
15
|
+
- :rocket: Allow setting `disabled` prop on TablerButton
|
|
16
|
+
|
|
17
|
+
### v3.77.0
|
|
18
|
+
|
|
19
|
+
- :tada: Allow changing the position of TablerDropdown
|
|
20
|
+
|
|
13
21
|
### v3.76.0
|
|
14
22
|
|
|
15
23
|
- :tada: Add focus event on Input component
|
package/components/Button.vue
CHANGED
package/components/Dropdown.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class='
|
|
2
|
+
<div :class='dropdownClasses'>
|
|
3
3
|
<div
|
|
4
4
|
:id='id'
|
|
5
5
|
data-bs-toggle='dropdown'
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</slot>
|
|
17
17
|
</div>
|
|
18
18
|
<ul
|
|
19
|
-
class='
|
|
19
|
+
:class='menuClasses'
|
|
20
20
|
:style='{
|
|
21
21
|
"width": width
|
|
22
22
|
}'
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script setup>
|
|
33
|
-
import { ref } from 'vue';
|
|
33
|
+
import { ref, computed } from 'vue';
|
|
34
34
|
import {
|
|
35
35
|
IconSettings
|
|
36
36
|
} from '@tabler/icons-vue';
|
|
@@ -43,8 +43,52 @@ const props = defineProps({
|
|
|
43
43
|
autoclose: {
|
|
44
44
|
type: String,
|
|
45
45
|
default: 'true'
|
|
46
|
+
},
|
|
47
|
+
position: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'bottom-end',
|
|
50
|
+
validator: (value) => {
|
|
51
|
+
const validPositions = [
|
|
52
|
+
'bottom', 'bottom-start', 'bottom-end',
|
|
53
|
+
'top', 'top-start', 'top-end',
|
|
54
|
+
'left', 'right'
|
|
55
|
+
];
|
|
56
|
+
return validPositions.includes(value);
|
|
57
|
+
}
|
|
46
58
|
}
|
|
47
59
|
});
|
|
48
60
|
|
|
49
61
|
const id = ref('tabler-dropdown-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now().toString(36));
|
|
62
|
+
|
|
63
|
+
const dropdownClasses = computed(() => {
|
|
64
|
+
const baseClass = 'dropdown';
|
|
65
|
+
|
|
66
|
+
switch (props.position) {
|
|
67
|
+
case 'top':
|
|
68
|
+
case 'top-start':
|
|
69
|
+
case 'top-end':
|
|
70
|
+
return `${baseClass} dropup`;
|
|
71
|
+
case 'left':
|
|
72
|
+
return `${baseClass} dropstart`;
|
|
73
|
+
case 'right':
|
|
74
|
+
return `${baseClass} dropend`;
|
|
75
|
+
default: // bottom, bottom-start, bottom-end
|
|
76
|
+
return baseClass;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const menuClasses = computed(() => {
|
|
81
|
+
const baseClasses = 'dropdown-menu dropdown-menu-card';
|
|
82
|
+
|
|
83
|
+
switch (props.position) {
|
|
84
|
+
case 'bottom-start':
|
|
85
|
+
case 'top-start':
|
|
86
|
+
return `${baseClasses} dropdown-menu-start`;
|
|
87
|
+
case 'bottom-end':
|
|
88
|
+
case 'top-end':
|
|
89
|
+
return `${baseClasses} dropdown-menu-end dropdown-menu-arrow`;
|
|
90
|
+
default: // bottom, top, left, right
|
|
91
|
+
return baseClasses;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
50
94
|
</script>
|