Skip to content

Commit

Permalink
feat: improve components & menu
Browse files Browse the repository at this point in the history
  • Loading branch information
50l3r committed Apr 4, 2024
1 parent 39cf42d commit f340353
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kodama-ui",
"version": "0.28.0",
"version": "0.30.0",
"description": "Kodama UI is a Vue 3 component library that provides a set of components & funcionality to build your application.",
"homepage": "https://50l3r.github.io/kodama-ui",
"keywords": [
Expand Down
4 changes: 3 additions & 1 deletion src/components/data-entry/k-switch/k-switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@
description: 'Tamaño del switch'
}
},
emits: ['update:modelValue'],
emits: ['update:modelValue', 'change'],
setup(props, ctx) {
const hasSlot = (name: string) => !!ctx.slots[name]
const onChange = (val: any) => {
ctx.emit('update:modelValue', val.target.checked)
ctx.emit('change', val.target.checked)
}
const model = computed({
Expand All @@ -85,6 +86,7 @@
},
set(val) {
ctx.emit('update:modelValue', val)
ctx.emit('change', val)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/feedback/k-empty/k-empty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:size="3"
bolder
uppercase
class="text-gray-900"
class="text-gray-900 dark:text-white"
>
{{ title }}
<template v-if="subtitle" #subtitle>
Expand Down
25 changes: 14 additions & 11 deletions src/layouts/main/partials/aside/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
</template>

<script lang="ts">
import { defineComponent, inject, onMounted } from 'vue'
import { computed, defineComponent, inject, onMounted } from 'vue'
import { RouteLocationRaw, useRoute } from 'vue-router'
import { Accordion } from 'flowbite'
Expand All @@ -221,24 +221,27 @@
const $menu: () => Menu[] = inject('$menu') || (() => [])
const SeparatorMenu: Menu[] = [{ separator: true }]
const FrontMenu: Menu[] = $menu()
const menu: Menu[] = [...FrontMenu, ...SeparatorMenu, ...SysMenu]
const menu = computed(() => {
const FrontMenu: Menu[] = $menu()
return [...FrontMenu, ...SeparatorMenu, ...SysMenu]
})
const hasActiveChildren = (match: RouteLocationRaw) => {
return route.path.indexOf(match.toString()) !== -1
}
const checkRoles = (menu: any) => {
if (menu.auth !== undefined) return !!menu.auth
const checkRoles = (item: any) => {
if (item.auth !== undefined) return !!item.auth
return true
}
const hasOneAccess = (menu: any) => {
if (menu.auth) return menu.auth
const hasOneAccess = (item: any) => {
if (item.auth) return item.auth
if (menu.pages) {
for (let i = 0; i < menu.pages.length; i++) {
const page = menu.pages[i]
if (item.pages) {
for (let i = 0; i < item.pages.length; i++) {
const page = item.pages[i]
if (page.auth) return page.auth
Expand All @@ -260,7 +263,7 @@
// create an array of objects with the id, trigger element (eg. button), and the content element
let accordionItems: any[] = []
let i = 0
menu.forEach((item) => {
menu.value.forEach((item) => {
if (item.pages) {
item.pages.forEach((page) => {
if (page.pages) {
Expand Down

0 comments on commit f340353

Please sign in to comment.