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