fix: frontend build error

This commit is contained in:
shaw
2025-12-18 14:26:55 +08:00
parent 642842c29e
commit 3d05e50335
33 changed files with 545 additions and 269 deletions

View File

@@ -47,7 +47,7 @@ interface Emits {
(e: 'cancel'): void
}
const props = withDefaults(defineProps<Props>(), {
withDefaults(defineProps<Props>(), {
confirmText: 'Confirm',
cancelText: 'Cancel',
danger: false

View File

@@ -86,16 +86,10 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import type { Column } from './types'
const { t } = useI18n()
export interface Column {
key: string
label: string
sortable?: boolean
formatter?: (value: any, row: any) => string
}
interface Props {
columns: Column[]
data: any[]

View File

@@ -69,7 +69,6 @@
<script setup lang="ts">
import type { Component } from 'vue'
import { RouterLink } from 'vue-router'
interface Props {
icon?: Component | string
@@ -81,7 +80,7 @@ interface Props {
message?: string
}
const props = withDefaults(defineProps<Props>(), {
withDefaults(defineProps<Props>(), {
title: 'No data found',
description: '',
actionIcon: true

View File

@@ -53,7 +53,7 @@
<div class="select-options">
<div
v-for="option in filteredOptions"
:key="getOptionValue(option)"
:key="getOptionValue(option) ?? undefined"
@click="selectOption(option)"
:class="[
'select-option',
@@ -136,9 +136,9 @@ const searchQuery = ref('')
const containerRef = ref<HTMLElement | null>(null)
const searchInputRef = ref<HTMLInputElement | null>(null)
const getOptionValue = (option: SelectOption | Record<string, unknown>): string | number | null => {
const getOptionValue = (option: SelectOption | Record<string, unknown>): string | number | null | undefined => {
if (typeof option === 'object' && option !== null) {
return option[props.valueKey] as string | number | null
return option[props.valueKey] as string | number | null | undefined
}
return option as string | number | null
}
@@ -187,7 +187,7 @@ const toggle = () => {
}
const selectOption = (option: SelectOption | Record<string, unknown>) => {
const value = getOptionValue(option)
const value = getOptionValue(option) ?? null
emit('update:modelValue', value)
emit('change', value, option as SelectOption)
isOpen.value = false

View File

@@ -121,7 +121,7 @@
</template>
<script setup lang="ts">
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue';
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
import { useI18n } from 'vue-i18n';
import subscriptionsAPI from '@/api/subscriptions';
import type { UserSubscription } from '@/types';

View File

@@ -10,4 +10,4 @@ export { default as EmptyState } from './EmptyState.vue'
export { default as LocaleSwitcher } from './LocaleSwitcher.vue'
// Export types
export type { Column } from './DataTable.vue'
export type { Column } from './types'

View File

@@ -0,0 +1,10 @@
/**
* Common component types
*/
export interface Column {
key: string
label: string
sortable?: boolean
formatter?: (value: any, row: any) => string
}