Merge branch 'dev' into feat/move-kai-ui-to-sidebar-195
This commit is contained in:
@@ -110,8 +110,8 @@ function handleActionCellClick(event: Event, _cellRef: string) {
|
||||
<TableBody v-else-if="rows.length === 0">
|
||||
<TableRow>
|
||||
<TableCell
|
||||
:colspan="keys.length"
|
||||
class="py-8 text-center"
|
||||
:colspan="keys.length + 1"
|
||||
class="py-5 text-center"
|
||||
>
|
||||
<div class="flex items-center justify-center">
|
||||
<Info class="size-5 text-muted-foreground" />
|
||||
|
||||
@@ -75,6 +75,7 @@ export interface LinkItem {
|
||||
icon?: string
|
||||
href?: string // to cover the needs of stating full external origins full url
|
||||
action?: string // for local paths
|
||||
groups?: string[]
|
||||
onClick?: (event: Event) => void
|
||||
headerStatus?: boolean
|
||||
}
|
||||
@@ -89,7 +90,6 @@ export const ActionEvents = {
|
||||
showVerify: 'showVerify',
|
||||
showConfirmVerify: 'showConfirmVerify',
|
||||
showValidate: 'showValidate',
|
||||
showConfirmVerify: 'showConfirmVerify',
|
||||
showPrint: 'showPrint',
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { cn } from '~/lib/utils'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
|
||||
const props = defineProps<{
|
||||
interface Props {
|
||||
fieldName: string
|
||||
label?: string
|
||||
placeholder?: string
|
||||
@@ -21,6 +21,19 @@ const props = defineProps<{
|
||||
isRequired?: boolean
|
||||
isDisabled?: boolean
|
||||
icons?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
label: '',
|
||||
placeholder: 'Choose file...',
|
||||
maxSizeMb: 1,
|
||||
isDisabled: false,
|
||||
isRequired: false,
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: File | null): void
|
||||
(e: 'fileSelected', file: File | null): void
|
||||
}>()
|
||||
|
||||
const hintMsg = computed(() => {
|
||||
@@ -35,7 +48,26 @@ async function onFileChange(event: Event, handleChange: (value: any) => void) {
|
||||
const target = event.target as HTMLInputElement
|
||||
const file = target.files?.[0]
|
||||
|
||||
if (!file) {
|
||||
handleChange(null)
|
||||
emit('update:modelValue', null)
|
||||
emit('fileSelected', null)
|
||||
return
|
||||
}
|
||||
|
||||
// Validate file size
|
||||
const maxSizeBytes = props.maxSizeMb * 1024 * 1024
|
||||
if (file.size > maxSizeBytes) {
|
||||
console.warn(`File size exceeds ${props.maxSizeMb}MB limit`)
|
||||
handleChange(null)
|
||||
emit('update:modelValue', null)
|
||||
emit('fileSelected', null)
|
||||
return
|
||||
}
|
||||
|
||||
handleChange(file)
|
||||
emit('update:modelValue', file)
|
||||
emit('fileSelected', file)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -62,7 +94,7 @@ async function onFileChange(event: Event, handleChange: (value: any) => void) {
|
||||
@change="onFileChange($event, handleChange)"
|
||||
type="file"
|
||||
:disabled="isDisabled"
|
||||
v-bind="{ onBlur: componentField.onBlur }"
|
||||
v-bind="{ onBlur: componentField.onBlur }"
|
||||
:placeholder="placeholder"
|
||||
:class="cn('focus:border-primary focus:ring-2 focus:ring-primary focus:ring-offset-0')"
|
||||
/>
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
type ClickType = 'back'
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click'): void
|
||||
(e: 'click', type: ClickType): void
|
||||
}>()
|
||||
|
||||
function onClick() {
|
||||
emit('click')
|
||||
function onClick(type: ClickType) {
|
||||
emit('click', type)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="m-2 flex gap-2 px-2">
|
||||
<Button
|
||||
class="bg-gray-400"
|
||||
type="button"
|
||||
@click="onClick"
|
||||
>
|
||||
<Icon
|
||||
name="i-lucide-arrow-left"
|
||||
class="me-2 align-middle"
|
||||
/>
|
||||
Back
|
||||
</Button>
|
||||
<div>
|
||||
<Button variant="ghost"@click="onClick('back')" >
|
||||
<Icon name="i-lucide-arrow-left" class="" />
|
||||
Back
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user