@usssa/component-library 1.0.0-alpha.26 → 1.0.0-alpha.27
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 +1 -1
- package/package.json +1 -1
- package/src/components/core/UMenuDropdown.vue +77 -0
- package/src/components/core/UMenutem.vue +4 -4
- package/src/components/index.js +2 -0
- package/src/layouts/MainLayout.vue +4 -0
- package/src/pages/MenuDropdown.vue +79 -0
- package/src/router/routes.js +4 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UMenuItem from './UMenutem.vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
data: {
|
|
6
|
+
type: Array,
|
|
7
|
+
},
|
|
8
|
+
destructive: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
iconClass: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'md',
|
|
18
|
+
validator: (val) => ['sm', 'md', 'lg'].includes(val),
|
|
19
|
+
},
|
|
20
|
+
menuClass: {
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
selected: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits(['onClick'])
|
|
29
|
+
|
|
30
|
+
const handleClick = () => {
|
|
31
|
+
return emit('onClick')
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<q-list :class="`u-menu-dropdown size-${size} ${menuClass}`">
|
|
37
|
+
<template v-for="(item, index) in data" :key="index">
|
|
38
|
+
<UMenuItem
|
|
39
|
+
:label="item.label"
|
|
40
|
+
:leftIcon="item.leftIcon"
|
|
41
|
+
:rightIcon="item.rightIcon"
|
|
42
|
+
@onClick="handleClick"
|
|
43
|
+
:destructive="destructive"
|
|
44
|
+
:iconClass="iconClass"
|
|
45
|
+
>
|
|
46
|
+
<template #leading_slot>
|
|
47
|
+
<slot name="leading_slot"></slot>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<template #trailing_slot>
|
|
51
|
+
<slot name="trailing_slot"></slot>
|
|
52
|
+
</template>
|
|
53
|
+
</UMenuItem>
|
|
54
|
+
</template>
|
|
55
|
+
</q-list>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style lang="sass">
|
|
59
|
+
.u-menu-dropdown
|
|
60
|
+
width: 11.5rem
|
|
61
|
+
padding: $xxs
|
|
62
|
+
flex-direction: column
|
|
63
|
+
align-items: flex-start
|
|
64
|
+
gap: q-my-xxs
|
|
65
|
+
flex-shrink: 0
|
|
66
|
+
border-radius: $xs
|
|
67
|
+
background: $neutral-1
|
|
68
|
+
box-shadow: 0px 0px 4px 0px rgba(16, 17, 20, 0.08)
|
|
69
|
+
&.size-sm
|
|
70
|
+
min-width: 11.5rem
|
|
71
|
+
max-width: 11.5rem
|
|
72
|
+
&.size-md
|
|
73
|
+
min-width: 11.75rem
|
|
74
|
+
max-width: 15rem
|
|
75
|
+
&.size-lg
|
|
76
|
+
width: 18rem
|
|
77
|
+
</style>
|
|
@@ -22,9 +22,6 @@ const props = defineProps({
|
|
|
22
22
|
iconClass: {
|
|
23
23
|
type: String,
|
|
24
24
|
},
|
|
25
|
-
onClick: {
|
|
26
|
-
type: Function,
|
|
27
|
-
},
|
|
28
25
|
})
|
|
29
26
|
|
|
30
27
|
const type = ref(props.destructive ? 'destructive' : 'default')
|
|
@@ -69,7 +66,7 @@ const backgroundColor = computed(() => {
|
|
|
69
66
|
</script>
|
|
70
67
|
|
|
71
68
|
<template>
|
|
72
|
-
<div class="u-menu-link">
|
|
69
|
+
<div class="u-menu-link q-mb-xxs">
|
|
73
70
|
<q-item
|
|
74
71
|
clickable
|
|
75
72
|
:class="`${backgroundColor} item-${type}`"
|
|
@@ -127,4 +124,7 @@ const backgroundColor = computed(() => {
|
|
|
127
124
|
opacity: 1
|
|
128
125
|
.label
|
|
129
126
|
word-break: break-all
|
|
127
|
+
|
|
128
|
+
.u-menu-link:last-child
|
|
129
|
+
margin-bottom : 0
|
|
130
130
|
</style>
|
package/src/components/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import UInputTextStd from './core/UInputTextStd.vue'
|
|
|
21
21
|
import UDialogStd from './core/UDialogStd.vue'
|
|
22
22
|
import URadioBtn from './core/URadioBtn.vue'
|
|
23
23
|
import UMenuItem from './core/UMenutem.vue'
|
|
24
|
+
import UMenuDropdown from './core/UMenuDropdown.vue'
|
|
24
25
|
|
|
25
26
|
import { useNotify } from '../composables/useNotify.js'
|
|
26
27
|
|
|
@@ -48,4 +49,5 @@ export {
|
|
|
48
49
|
UDialogStd,
|
|
49
50
|
UInputPhoneStd,
|
|
50
51
|
UMenuItem,
|
|
52
|
+
UMenuDropdown,
|
|
51
53
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { UMenuDropdown } from 'src/components'
|
|
4
|
+
import ComponentBase from './ComponentBase.vue'
|
|
5
|
+
|
|
6
|
+
const Data = [
|
|
7
|
+
{
|
|
8
|
+
label: 'Profile',
|
|
9
|
+
leftIcon: 'fa-kit-duotone fa-user',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: 'Settings',
|
|
13
|
+
leftIcon: 'fa-kit-duotone fa-admin',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 'Logout',
|
|
17
|
+
leftIcon: 'fa-kit-duotone fa-logout',
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const size = ref('sm')
|
|
22
|
+
const sizeOptions = ['sm', 'md', 'lg']
|
|
23
|
+
|
|
24
|
+
const htmlContent = `<UMenuDropdown
|
|
25
|
+
:data="Data"
|
|
26
|
+
@onClick="onClick"
|
|
27
|
+
iconClass="icon-secondary-opacity"
|
|
28
|
+
:size="size"
|
|
29
|
+
/>`
|
|
30
|
+
|
|
31
|
+
defineOptions({
|
|
32
|
+
name: 'UMenuDropdown',
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const onClick = () => {
|
|
36
|
+
console.log('check....')
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<q-page class="flex flex-center">
|
|
42
|
+
<ComponentBase
|
|
43
|
+
figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-24&node-type=canvas&t=nWq2UjUIdqvWKgPg-0"
|
|
44
|
+
>
|
|
45
|
+
<template v-slot:component>
|
|
46
|
+
<!-- Using test-cls to demonstrate how to pass custom css -->
|
|
47
|
+
<UMenuDropdown
|
|
48
|
+
:data="Data"
|
|
49
|
+
@onClick="onClick"
|
|
50
|
+
iconClass="icon-secondary-opacity"
|
|
51
|
+
:size="size"
|
|
52
|
+
menuClass="test-cls"
|
|
53
|
+
>
|
|
54
|
+
<!-- Use slot here like this -->
|
|
55
|
+
<!-- <template #trailing_slot>
|
|
56
|
+
Write your code here
|
|
57
|
+
</template> -->
|
|
58
|
+
</UMenuDropdown>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<template v-slot:properties>
|
|
62
|
+
<div class="q-gutter-y-lg">
|
|
63
|
+
<q-select v-model="size" :options="sizeOptions" label="Size" />
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<template v-slot:code>
|
|
68
|
+
<pre>{{ htmlContent }}</pre>
|
|
69
|
+
</template>
|
|
70
|
+
</ComponentBase>
|
|
71
|
+
</q-page>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<style lang="sass">
|
|
75
|
+
.test-cls
|
|
76
|
+
max-height: 11.25rem !important
|
|
77
|
+
overflow-y: auto
|
|
78
|
+
scrollbar-width: none // use this if we dont want to show scrollbar
|
|
79
|
+
</style>
|
package/src/router/routes.js
CHANGED