Merge branch 'dev' into feat/surat-kontrol-135
This commit is contained in:
No files matched your search
@@ -2,9 +2,14 @@
|
||||
import type { LinkItem, ListItemDto } from './types'
|
||||
import { ActionEvents } from './types'
|
||||
|
||||
const props = defineProps<{
|
||||
interface Props {
|
||||
rec: ListItemDto
|
||||
}>()
|
||||
size?: 'default' | 'sm' | 'lg'
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
size: 'lg',
|
||||
})
|
||||
|
||||
const recId = inject<Ref<number>>('rec_id')!
|
||||
const recAction = inject<Ref<string>>('rec_action')!
|
||||
@@ -58,7 +63,7 @@ function del() {
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child>
|
||||
<SidebarMenuButton
|
||||
size="lg"
|
||||
:size="size"
|
||||
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
|
||||
>
|
||||
<Icon
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, type Ref } from 'vue'
|
||||
// Components
|
||||
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
|
||||
|
||||
const props = defineProps<{
|
||||
rec: { id: string; name: string; menu: string }
|
||||
selected?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
// No emits needed - using provide/inject
|
||||
}>()
|
||||
|
||||
const record = props.rec || {}
|
||||
const recId = inject('rec_select_id') as Ref<number>
|
||||
const recMenu = inject('rec_select_menu') as Ref<string>
|
||||
const selected = computed(() => recId.value === Number(record.id) ? record.id : '')
|
||||
|
||||
function handleSelection(value: string) {
|
||||
if (value === record.id) {
|
||||
recId.value = Number(record.id) || 0
|
||||
recMenu.value = record.menu || ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroup
|
||||
:model-value="selected"
|
||||
@update:model-value="handleSelection"
|
||||
>
|
||||
<RadioGroupItem
|
||||
:id="record.id"
|
||||
:value="record.id"
|
||||
/>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -8,6 +8,7 @@ export interface ListItemDto {
|
||||
}
|
||||
|
||||
export type ComponentType = Component
|
||||
export type ComponentWithProps = { component: Component, props: Record<string, any> }
|
||||
|
||||
export interface ButtonNav {
|
||||
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
||||
@@ -51,13 +52,13 @@ export interface RefExportNav {
|
||||
export interface HeaderPrep {
|
||||
title?: string
|
||||
icon?: string
|
||||
components?: ComponentWithProps[]
|
||||
refSearchNav?: RefSearchNav
|
||||
quickSearchNav?: QuickSearchNav
|
||||
filterNav?: ButtonNav
|
||||
addNav?: ButtonNav
|
||||
printNav?: ButtonNav
|
||||
}
|
||||
|
||||
export interface KeyLabel {
|
||||
key: string
|
||||
label: string
|
||||
|
||||
Reference in New Issue
Block a user