|
|
@ -37,6 +37,7 @@ const props = defineProps<{ |
|
|
|
hideType?: boolean |
|
|
|
hideType?: boolean |
|
|
|
hideAdditionalOptions?: boolean |
|
|
|
hideAdditionalOptions?: boolean |
|
|
|
fromTableExplorer?: boolean |
|
|
|
fromTableExplorer?: boolean |
|
|
|
|
|
|
|
readonly?: boolean |
|
|
|
}>() |
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['submit', 'cancel', 'mounted', 'add', 'update']) |
|
|
|
const emit = defineEmits(['submit', 'cancel', 'mounted', 'add', 'update']) |
|
|
@ -66,6 +67,8 @@ const isForm = inject(IsFormInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
const isKanban = inject(IsKanbanInj, ref(false)) |
|
|
|
const isKanban = inject(IsKanbanInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const readOnly = computed(() => props.readonly) |
|
|
|
|
|
|
|
|
|
|
|
const { isMysql, isMssql, isXcdbBase } = useBase() |
|
|
|
const { isMysql, isMssql, isXcdbBase } = useBase() |
|
|
|
|
|
|
|
|
|
|
|
const reloadDataTrigger = inject(ReloadViewDataHookInj) |
|
|
|
const reloadDataTrigger = inject(ReloadViewDataHookInj) |
|
|
@ -114,6 +117,8 @@ const reloadMetaAndData = async () => { |
|
|
|
const saving = ref(false) |
|
|
|
const saving = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
async function onSubmit() { |
|
|
|
async function onSubmit() { |
|
|
|
|
|
|
|
if (readOnly.value) return |
|
|
|
|
|
|
|
|
|
|
|
saving.value = true |
|
|
|
saving.value = true |
|
|
|
const saved = await addOrUpdate(reloadMetaAndData, props.columnPosition) |
|
|
|
const saved = await addOrUpdate(reloadMetaAndData, props.columnPosition) |
|
|
|
saving.value = false |
|
|
|
saving.value = false |
|
|
@ -134,7 +139,7 @@ async function onSubmit() { |
|
|
|
// focus and select the column name field |
|
|
|
// focus and select the column name field |
|
|
|
const antInput = ref() |
|
|
|
const antInput = ref() |
|
|
|
watchEffect(() => { |
|
|
|
watchEffect(() => { |
|
|
|
if (antInput.value && formState.value) { |
|
|
|
if (antInput.value && formState.value && !readOnly.value) { |
|
|
|
// todo: replace setTimeout |
|
|
|
// todo: replace setTimeout |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
// focus and select input only if active element is not an input or textarea |
|
|
|
// focus and select input only if active element is not an input or textarea |
|
|
@ -232,6 +237,7 @@ if (props.fromTableExplorer) { |
|
|
|
<input |
|
|
|
<input |
|
|
|
ref="antInput" |
|
|
|
ref="antInput" |
|
|
|
v-model="formState.title" |
|
|
|
v-model="formState.title" |
|
|
|
|
|
|
|
:disabled="readOnly" |
|
|
|
class="flex flex-grow nc-fields-input text-lg font-bold outline-none bg-inherit" |
|
|
|
class="flex flex-grow nc-fields-input text-lg font-bold outline-none bg-inherit" |
|
|
|
:contenteditable="true" |
|
|
|
:contenteditable="true" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -247,7 +253,7 @@ if (props.fromTableExplorer) { |
|
|
|
ref="antInput" |
|
|
|
ref="antInput" |
|
|
|
v-model:value="formState.title" |
|
|
|
v-model:value="formState.title" |
|
|
|
class="nc-column-name-input !rounded !mt-1" |
|
|
|
class="nc-column-name-input !rounded !mt-1" |
|
|
|
:disabled="isKanban" |
|
|
|
:disabled="isKanban || readOnly" |
|
|
|
@input="onAlter(8)" |
|
|
|
@input="onAlter(8)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
@ -263,7 +269,7 @@ if (props.fromTableExplorer) { |
|
|
|
v-model:value="formState.uidt" |
|
|
|
v-model:value="formState.uidt" |
|
|
|
show-search |
|
|
|
show-search |
|
|
|
class="nc-column-type-input !rounded" |
|
|
|
class="nc-column-type-input !rounded" |
|
|
|
:disabled="isKanban" |
|
|
|
:disabled="isKanban || readOnly" |
|
|
|
dropdown-class-name="nc-dropdown-column-type " |
|
|
|
dropdown-class-name="nc-dropdown-column-type " |
|
|
|
@change="onUidtOrIdTypeChange" |
|
|
|
@change="onUidtOrIdTypeChange" |
|
|
|
@dblclick="showDeprecated = !showDeprecated" |
|
|
|
@dblclick="showDeprecated = !showDeprecated" |
|
|
@ -285,28 +291,30 @@ if (props.fromTableExplorer) { |
|
|
|
</div> --> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<LazySmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" v-model:value="formState" /> |
|
|
|
<template v-if="!readOnly"> |
|
|
|
<LazySmartsheetColumnQrCodeOptions v-if="formState.uidt === UITypes.QrCode" v-model="formState" /> |
|
|
|
<LazySmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnBarcodeOptions v-if="formState.uidt === UITypes.Barcode" v-model="formState" /> |
|
|
|
<LazySmartsheetColumnQrCodeOptions v-if="formState.uidt === UITypes.QrCode" v-model="formState" /> |
|
|
|
<LazySmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnBarcodeOptions v-if="formState.uidt === UITypes.Barcode" v-model="formState" /> |
|
|
|
<LazySmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnCheckboxOptions v-if="formState.uidt === UITypes.Checkbox" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnLookupOptions v-if="formState.uidt === UITypes.Lookup" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnCheckboxOptions v-if="formState.uidt === UITypes.Checkbox" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDateOptions v-if="formState.uidt === UITypes.Date" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnLookupOptions v-if="formState.uidt === UITypes.Lookup" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDecimalOptions v-if="formState.uidt === UITypes.Decimal" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDateOptions v-if="formState.uidt === UITypes.Date" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDateTimeOptions v-if="formState.uidt === UITypes.DateTime" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDecimalOptions v-if="formState.uidt === UITypes.Decimal" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnRollupOptions v-if="formState.uidt === UITypes.Rollup" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnDateTimeOptions v-if="formState.uidt === UITypes.DateTime" v-model:value="formState" /> |
|
|
|
<LazySmartsheetColumnLinkedToAnotherRecordOptions |
|
|
|
<LazySmartsheetColumnRollupOptions v-if="formState.uidt === UITypes.Rollup" v-model:value="formState" /> |
|
|
|
v-if="!isEdit && (formState.uidt === UITypes.LinkToAnotherRecord || formState.uidt === UITypes.Links)" |
|
|
|
<LazySmartsheetColumnLinkedToAnotherRecordOptions |
|
|
|
v-model:value="formState" |
|
|
|
v-if="!isEdit && (formState.uidt === UITypes.LinkToAnotherRecord || formState.uidt === UITypes.Links)" |
|
|
|
/> |
|
|
|
v-model:value="formState" |
|
|
|
<LazySmartsheetColumnLinkOptions v-if="isEdit && formState.uidt === UITypes.Links" v-model:value="formState" /> |
|
|
|
/> |
|
|
|
<LazySmartsheetColumnSpecificDBTypeOptions v-if="formState.uidt === UITypes.SpecificDBType" /> |
|
|
|
<LazySmartsheetColumnLinkOptions v-if="isEdit && formState.uidt === UITypes.Links" v-model:value="formState" /> |
|
|
|
<SmartsheetColumnSelectOptions |
|
|
|
<LazySmartsheetColumnSpecificDBTypeOptions v-if="formState.uidt === UITypes.SpecificDBType" /> |
|
|
|
v-if="formState.uidt === UITypes.SingleSelect || formState.uidt === UITypes.MultiSelect" |
|
|
|
<SmartsheetColumnSelectOptions |
|
|
|
v-model:value="formState" |
|
|
|
v-if="formState.uidt === UITypes.SingleSelect || formState.uidt === UITypes.MultiSelect" |
|
|
|
/> |
|
|
|
v-model:value="formState" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<a-checkbox |
|
|
|
<a-checkbox |
|
|
|
v-if="formState.meta && columnToValidate.includes(formState.uidt)" |
|
|
|
v-if="formState.meta && columnToValidate.includes(formState.uidt)" |
|
|
@ -317,41 +325,43 @@ if (props.fromTableExplorer) { |
|
|
|
{{ `${$t('msg.acceptOnlyValid')} ${formState.uidt}` }} |
|
|
|
{{ `${$t('msg.acceptOnlyValid')} ${formState.uidt}` }} |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</a-checkbox> |
|
|
|
</a-checkbox> |
|
|
|
<div class="!my-3"> |
|
|
|
<template v-if="!readOnly"> |
|
|
|
<!-- |
|
|
|
<div class="!my-3"> |
|
|
|
Default Value for JSON & LongText is not supported in MySQL |
|
|
|
<!-- |
|
|
|
Default Value is Disabled for MSSQL --> |
|
|
|
Default Value for JSON & LongText is not supported in MySQL |
|
|
|
<LazySmartsheetColumnDefaultValue |
|
|
|
Default Value is Disabled for MSSQL --> |
|
|
|
v-if=" |
|
|
|
<LazySmartsheetColumnDefaultValue |
|
|
|
|
|
|
|
v-if=" |
|
|
|
!isVirtualCol(formState) && |
|
|
|
!isVirtualCol(formState) && |
|
|
|
!isAttachment(formState) && |
|
|
|
!isAttachment(formState) && |
|
|
|
!isMssql(meta!.source_id) && |
|
|
|
!isMssql(meta!.source_id) && |
|
|
|
!(isMysql(meta!.source_id) && (isJSON(formState) || isTextArea(formState))) |
|
|
|
!(isMysql(meta!.source_id) && (isJSON(formState) || isTextArea(formState))) |
|
|
|
" |
|
|
|
" |
|
|
|
v-model:value="formState" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
v-if="!props.hideAdditionalOptions && !isVirtualCol(formState.uidt) && (!appInfo.ee || (appInfo.ee && !isXcdbBase(meta!.source_id) && formState.uidt === UITypes.SpecificDBType))" |
|
|
|
|
|
|
|
class="text-xs cursor-pointer text-gray-400 nc-more-options mb-1 mt-4 flex items-center gap-1 justify-end" |
|
|
|
|
|
|
|
@click="advancedOptions = !advancedOptions" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{{ advancedOptions ? $t('general.hideAll') : $t('general.showMore') }} |
|
|
|
|
|
|
|
<component :is="advancedOptions ? MdiMinusIcon : MdiPlusIcon" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Transition name="layout" mode="out-in"> |
|
|
|
|
|
|
|
<div v-if="advancedOptions" class="overflow-hidden"> |
|
|
|
|
|
|
|
<LazySmartsheetColumnAttachmentOptions v-if="appInfo.ee && isAttachment(formState)" v-model:value="formState" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<LazySmartsheetColumnAdvancedOptions |
|
|
|
|
|
|
|
v-if="formState.uidt !== UITypes.Attachment" |
|
|
|
|
|
|
|
v-model:value="formState" |
|
|
|
v-model:value="formState" |
|
|
|
:advanced-db-options="advancedOptions || formState.uidt === UITypes.SpecificDBType" |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Transition> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
v-if="!props.hideAdditionalOptions && !isVirtualCol(formState.uidt) && (!appInfo.ee || (appInfo.ee && !isXcdbBase(meta!.source_id) && formState.uidt === UITypes.SpecificDBType))" |
|
|
|
|
|
|
|
class="text-xs cursor-pointer text-gray-400 nc-more-options mb-1 mt-4 flex items-center gap-1 justify-end" |
|
|
|
|
|
|
|
@click="advancedOptions = !advancedOptions" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{{ advancedOptions ? $t('general.hideAll') : $t('general.showMore') }} |
|
|
|
|
|
|
|
<component :is="advancedOptions ? MdiMinusIcon : MdiPlusIcon" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Transition name="layout" mode="out-in"> |
|
|
|
|
|
|
|
<div v-if="advancedOptions" class="overflow-hidden"> |
|
|
|
|
|
|
|
<LazySmartsheetColumnAttachmentOptions v-if="appInfo.ee && isAttachment(formState)" v-model:value="formState" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<LazySmartsheetColumnAdvancedOptions |
|
|
|
|
|
|
|
v-if="formState.uidt !== UITypes.Attachment" |
|
|
|
|
|
|
|
v-model:value="formState" |
|
|
|
|
|
|
|
:advanced-db-options="advancedOptions || formState.uidt === UITypes.SpecificDBType" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</Transition> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<template v-if="props.fromTableExplorer"> |
|
|
|
<template v-if="props.fromTableExplorer"> |
|
|
|
<a-form-item></a-form-item> |
|
|
|
<a-form-item></a-form-item> |
|
|
|