|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { Form } from 'ant-design-vue' |
|
|
|
|
import { useToast } from 'vue-toastification' |
|
|
|
|
import { onMounted, useProject, useTable, useTabs } from '#imports' |
|
|
|
|
import { validateTableName } from '~/utils/validation' |
|
|
|
|
import { TabType } from '~/composables' |
|
|
|
@ -15,12 +14,6 @@ const emit = defineEmits(['update:modelValue'])
|
|
|
|
|
|
|
|
|
|
const dialogShow = useVModel(props, 'modelValue', emit) |
|
|
|
|
|
|
|
|
|
const toast = useToast() |
|
|
|
|
|
|
|
|
|
const valid = ref(false) |
|
|
|
|
|
|
|
|
|
const isIdToggleAllowed = ref(false) |
|
|
|
|
|
|
|
|
|
const isAdvanceOptVisible = ref(false) |
|
|
|
|
|
|
|
|
|
const { addTab } = useTabs() |
|
|
|
@ -38,17 +31,17 @@ const { table, createTable, generateUniqueTitle, tables, project } = useTable(as
|
|
|
|
|
dialogShow.value = false |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const prefix = computed(() => project?.value?.prefix || '') |
|
|
|
|
// const prefix = computed(() => project?.value?.prefix || '') |
|
|
|
|
|
|
|
|
|
const validateDuplicateAlias = (v: string) => { |
|
|
|
|
return (tables?.value || []).every((t) => t.title !== (v || '')) || 'Duplicate table alias' |
|
|
|
|
} |
|
|
|
|
const validateLeadingOrTrailingWhiteSpace = (v: string) => { |
|
|
|
|
return !/^\s+|\s+$/.test(v) || 'Leading or trailing whitespace not allowed in table name' |
|
|
|
|
} |
|
|
|
|
const validateDuplicate = (v: string) => { |
|
|
|
|
return (tables?.value || []).every((t) => t.table_name.toLowerCase() !== (v || '').toLowerCase()) || 'Duplicate table name' |
|
|
|
|
} |
|
|
|
|
// const validateLeadingOrTrailingWhiteSpace = (v: string) => { |
|
|
|
|
// return !/^\s+|\s+$/.test(v) || 'Leading or trailing whitespace not allowed in table name' |
|
|
|
|
// } |
|
|
|
|
// const validateDuplicate = (v: string) => { |
|
|
|
|
// return (tables?.value || []).every((t) => t.table_name.toLowerCase() !== (v || '').toLowerCase()) || 'Duplicate table name' |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
const inputEl = ref<HTMLInputElement>() |
|
|
|
|
|
|
|
|
@ -60,7 +53,7 @@ const validators = computed(() => {
|
|
|
|
|
table_name: [validateTableName], |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
const { resetFields, validate, validateInfos } = useForm(table, validators) |
|
|
|
|
const { validateInfos } = useForm(table, validators) |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
generateUniqueTitle() |
|
|
|
|