Merge pull request #200 from dikstub-rssa/feat/encounter-adjustment-163

Feat: Encounter Adjustment
This commit is contained in:
Munawwirul Jamal
2025-12-04 11:51:35 +07:00
committed by GitHub
61 changed files with 1542 additions and 785 deletions
+1
View File
@@ -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
}
+34 -2
View File
@@ -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')"
/>