import { computed, defineComponent, type PropType, ref } from 'vue'; import { DefaultComponentProps } from '../_default'; import BCMSButton from '../button'; import BCMSIcon from '../icon'; import BCMSManagerNavItem from './nav-item'; import type { BCMSManagerNavItemType } from '../../types'; import { useRouter } from 'vue-router'; import { BCMSSelect } from '../input'; import pluralize from 'pluralize'; const component = defineComponent({ props: { ...DefaultComponentProps, label: { type: String, default: '', }, items: { type: Array as PropType, default: () => [], }, actionText: String, }, emits: { click: (_event: Event, _item: BCMSManagerNavItemType) => { return true; }, action: () => { return true; }, }, setup(props, ctx) { const extended = ref(true); const router = useRouter(); const items = computed(() => { return ( JSON.parse(JSON.stringify(props.items)) as BCMSManagerNavItemType[] ).sort((a, b) => { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } return 0; }); }); return () => (
{ctx.slots.default ? ( ctx.slots.default() ) : ( <> { return { label: e.name, value: e.link }; })} selected={ props.items.find((e) => e.selected) ? props.items.find((e) => e.selected)?.link : '' } onChange={(event) => { router.push(event.value); }} />
    {items.value.map((item) => { return ( { router.push(item.link); }} /> ); })}
)}
{props.actionText ? ( ) : ( '' )}
); }, }); export default component;