|
|
@ -1,4 +1,4 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { ComponentPublicInstance } from '@vue/runtime-core' |
|
|
|
import type { ComponentPublicInstance } from '@vue/runtime-core' |
|
|
|
import { capitalize } from '@vue/runtime-core' |
|
|
|
import { capitalize } from '@vue/runtime-core' |
|
|
|
import type { Form as AntForm, SelectProps } from 'ant-design-vue' |
|
|
|
import type { Form as AntForm, SelectProps } from 'ant-design-vue' |
|
|
@ -195,7 +195,13 @@ async function onSubmit() { |
|
|
|
data = await api.dbView.mapCreate(tableId.value, form) |
|
|
|
data = await api.dbView.mapCreate(tableId.value, form) |
|
|
|
break |
|
|
|
break |
|
|
|
case ViewTypes.CALENDAR: |
|
|
|
case ViewTypes.CALENDAR: |
|
|
|
data = await api.dbView.calendarCreate(tableId.value, form) |
|
|
|
data = await api.dbView.calendarCreate(tableId.value, { |
|
|
|
|
|
|
|
...form, |
|
|
|
|
|
|
|
calendar_range: form.calendarRange.map((range) => ({ |
|
|
|
|
|
|
|
fk_from_column_id: range.fk_from_column_id, |
|
|
|
|
|
|
|
fk_to_column_id: range.fk_to_column_id, |
|
|
|
|
|
|
|
})), |
|
|
|
|
|
|
|
}) |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -364,56 +370,56 @@ onMounted(async () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<a |
|
|
|
<a |
|
|
|
v-if="!form.copy_from_id" |
|
|
|
v-if="!form.copy_from_id" |
|
|
|
|
|
|
|
class="text-sm !no-underline !hover:text-brand-500 text-brand-500" |
|
|
|
href="https://docs.nocodb.com/views/view-types/calendar/" |
|
|
|
href="https://docs.nocodb.com/views/view-types/calendar/" |
|
|
|
target="_blank" |
|
|
|
target="_blank" |
|
|
|
class="text-sm !no-underline !hover:text-brand-500 text-brand-500" |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
Go to Docs |
|
|
|
Go to Docs |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<div class="mt-2"> |
|
|
|
<div class="mt-2"> |
|
|
|
<a-form v-if="isNecessaryColumnsPresent" ref="formValidator" layout="vertical" :model="form"> |
|
|
|
<a-form v-if="isNecessaryColumnsPresent" ref="formValidator" :model="form" layout="vertical"> |
|
|
|
<a-form-item name="title" :rules="viewNameRules"> |
|
|
|
<a-form-item :rules="viewNameRules" name="title"> |
|
|
|
<a-input |
|
|
|
<a-input |
|
|
|
ref="inputEl" |
|
|
|
ref="inputEl" |
|
|
|
v-model:value="form.title" |
|
|
|
v-model:value="form.title" |
|
|
|
class="nc-input-md h-10" |
|
|
|
|
|
|
|
autofocus |
|
|
|
|
|
|
|
:placeholder="$t('labels.viewName')" |
|
|
|
:placeholder="$t('labels.viewName')" |
|
|
|
|
|
|
|
autofocus |
|
|
|
|
|
|
|
class="nc-input-md h-10" |
|
|
|
@keydown.enter="onSubmit" |
|
|
|
@keydown.enter="onSubmit" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item |
|
|
|
<a-form-item |
|
|
|
v-if="form.type === ViewTypes.KANBAN" |
|
|
|
v-if="form.type === ViewTypes.KANBAN" |
|
|
|
:label="$t('general.groupingField')" |
|
|
|
:label="$t('general.groupingField')" |
|
|
|
name="fk_grp_col_id" |
|
|
|
|
|
|
|
:rules="groupingFieldColumnRules" |
|
|
|
:rules="groupingFieldColumnRules" |
|
|
|
|
|
|
|
name="fk_grp_col_id" |
|
|
|
> |
|
|
|
> |
|
|
|
<NcSelect |
|
|
|
<NcSelect |
|
|
|
v-model:value="form.fk_grp_col_id" |
|
|
|
v-model:value="form.fk_grp_col_id" |
|
|
|
class="w-full nc-kanban-grouping-field-select" |
|
|
|
|
|
|
|
:disabled="isMetaLoading" |
|
|
|
:disabled="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
|
|
|
|
:not-found-content="$t('placeholder.selectGroupFieldNotFound')" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
:placeholder="$t('placeholder.selectGroupField')" |
|
|
|
:placeholder="$t('placeholder.selectGroupField')" |
|
|
|
:not-found-content="$t('placeholder.selectGroupFieldNotFound')" |
|
|
|
class="w-full nc-kanban-grouping-field-select" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item |
|
|
|
<a-form-item |
|
|
|
v-if="form.type === ViewTypes.MAP" |
|
|
|
v-if="form.type === ViewTypes.MAP" |
|
|
|
:label="$t('general.geoDataField')" |
|
|
|
:label="$t('general.geoDataField')" |
|
|
|
name="fk_geo_data_col_id" |
|
|
|
|
|
|
|
:rules="geoDataFieldColumnRules" |
|
|
|
:rules="geoDataFieldColumnRules" |
|
|
|
|
|
|
|
name="fk_geo_data_col_id" |
|
|
|
> |
|
|
|
> |
|
|
|
<NcSelect |
|
|
|
<NcSelect |
|
|
|
v-model:value="form.fk_geo_data_col_id" |
|
|
|
v-model:value="form.fk_geo_data_col_id" |
|
|
|
class="w-full" |
|
|
|
|
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
|
|
|
|
:disabled="isMetaLoading" |
|
|
|
:disabled="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:placeholder="$t('placeholder.selectGeoField')" |
|
|
|
|
|
|
|
:not-found-content="$t('placeholder.selectGeoFieldNotFound')" |
|
|
|
:not-found-content="$t('placeholder.selectGeoFieldNotFound')" |
|
|
|
|
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
|
|
|
|
:placeholder="$t('placeholder.selectGeoField')" |
|
|
|
|
|
|
|
class="w-full" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<template v-if="form.type === ViewTypes.CALENDAR"> |
|
|
|
<template v-if="form.type === ViewTypes.CALENDAR"> |
|
|
@ -424,10 +430,10 @@ onMounted(async () => { |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
<NcSelect |
|
|
|
<NcSelect |
|
|
|
v-model:value="range.fk_from_column_id" |
|
|
|
v-model:value="range.fk_from_column_id" |
|
|
|
class="w-full" |
|
|
|
|
|
|
|
:disabled="isMetaLoading" |
|
|
|
:disabled="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
|
|
|
|
class="w-full" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="range.fk_to_column_id === null && isEeUI" class="flex flex-col justify-end w-1/2"> |
|
|
|
<div v-if="range.fk_to_column_id === null && isEeUI" class="flex flex-col justify-end w-1/2"> |
|
|
@ -453,18 +459,18 @@ onMounted(async () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<NcSelect |
|
|
|
<NcSelect |
|
|
|
v-model:value="range.fk_to_column_id" |
|
|
|
v-model:value="range.fk_to_column_id" |
|
|
|
class="w-full" |
|
|
|
|
|
|
|
:disabled="isMetaLoading" |
|
|
|
:disabled="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:loading="isMetaLoading" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
:options="viewSelectFieldOptions" |
|
|
|
:placeholder="$t('placeholder.notSelected')" |
|
|
|
:placeholder="$t('placeholder.notSelected')" |
|
|
|
|
|
|
|
class="w-full" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</a-form> |
|
|
|
</a-form> |
|
|
|
<div v-else-if="!isNecessaryColumnsPresent" class="flex flex-row p-4 border-gray-200 border-1 gap-x-4 rounded-lg w-full"> |
|
|
|
<div v-else-if="!isNecessaryColumnsPresent" class="flex flex-row p-4 border-gray-200 border-1 gap-x-4 rounded-lg w-full"> |
|
|
|
<GeneralIcon icon="warning" class="!text-5xl text-orange-500" /> |
|
|
|
<GeneralIcon class="!text-5xl text-orange-500" icon="warning" /> |
|
|
|
<div class="text-gray-500"> |
|
|
|
<div class="text-gray-500"> |
|
|
|
<h2 class="font-semibold text-sm text-gray-800">Suitable fields not present</h2> |
|
|
|
<h2 class="font-semibold text-sm text-gray-800">Suitable fields not present</h2> |
|
|
|
{{ errorMessages[form.type] }} |
|
|
|
{{ errorMessages[form.type] }} |
|
|
@ -478,9 +484,9 @@ onMounted(async () => { |
|
|
|
|
|
|
|
|
|
|
|
<NcButton |
|
|
|
<NcButton |
|
|
|
v-e="[form.copy_from_id ? 'a:view:duplicate' : 'a:view:create']" |
|
|
|
v-e="[form.copy_from_id ? 'a:view:duplicate' : 'a:view:create']" |
|
|
|
type="primary" |
|
|
|
|
|
|
|
:disabled="!isNecessaryColumnsPresent" |
|
|
|
:disabled="!isNecessaryColumnsPresent" |
|
|
|
:loading="isViewCreating" |
|
|
|
:loading="isViewCreating" |
|
|
|
|
|
|
|
type="primary" |
|
|
|
@click="onSubmit" |
|
|
|
@click="onSubmit" |
|
|
|
> |
|
|
|
> |
|
|
|
{{ $t('labels.createView') }} |
|
|
|
{{ $t('labels.createView') }} |
|
|
|