Browse Source

fix: lint errors (#7685)

* fix(nc-gui): lint issues

* fix(nc-gui): lint issues
pull/7696/head
Anbarasu 7 months ago committed by GitHub
parent
commit
81ccf61de2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 37
      packages/nc-gui/components/dlg/ViewCreate.vue
  2. 1
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue
  3. 15
      packages/nc-gui/components/smartsheet/toolbar/CalendarRange.vue
  4. 1
      packages/nc-gui/layouts/shared-view.vue

37
packages/nc-gui/components/dlg/ViewCreate.vue

@ -217,12 +217,15 @@ async function onSubmit() {
} }
} }
/*
TODO: Add support for end date and multiple range in future
const addCalendarRange = async () => { const addCalendarRange = async () => {
form.calendar_range.push({ form.calendar_range.push({
fk_from_column_id: viewSelectFieldOptions.value[0].value as string, fk_from_column_id: viewSelectFieldOptions.value[0].value as string,
fk_to_column_id: null, fk_to_column_id: null,
}) })
} }
*/
const isMetaLoading = ref(false) const isMetaLoading = ref(false)
@ -450,18 +453,22 @@ onMounted(async () => {
</div> </div>
</a-select-option> </a-select-option>
</NcSelect> </NcSelect>
<div <!--
v-if="range.fk_to_column_id === null && isEeUI && false" <div
class="cursor-pointer flex items-center text-gray-800 gap-1" v-if="range.fk_to_column_id === null && isEeUI"
@click="range.fk_to_column_id = undefined" class="cursor-pointer flex items-center text-gray-800 gap-1"
> @click="range.fk_to_column_id = undefined"
<component :is="iconMap.plus" class="h-4 w-4" /> >
{{ $t('activity.addEndDate') }} <component :is="iconMap.plus" class="h-4 w-4" />
</div> {{ $t('activity.addEndDate') }}
<template v-else-if="isEeUI && false"> </div>
<span> <template v-else-if="isEeUI">
<span>
{{ $t('activity.withEndDate') }} {{ $t('activity.withEndDate') }}
</span> </span>
TODO: Add support for end date and multiple range in future
<div class="flex"> <div class="flex">
<NcSelect <NcSelect
v-model:value="range.fk_to_column_id" v-model:value="range.fk_to_column_id"
@ -492,10 +499,10 @@ onMounted(async () => {
</NcSelect> </NcSelect>
<NcButton class="!rounded-l-none !border-l-0" size="small" type="secondary" @click="range.fk_to_column_id = null"> <NcButton class="!rounded-l-none !border-l-0" size="small" type="secondary" @click="range.fk_to_column_id = null">
<component :is="iconMap.delete" class="h-4 w-4" /> <component :is="iconMap.delete" class="h-4 w-4" />
</NcButton> </NcButton> -->
</div> </div>
</template> </template>
<NcButton <!-- <NcButton
v-if="index !== 0" v-if="index !== 0"
size="small" size="small"
type="secondary" type="secondary"
@ -508,11 +515,11 @@ onMounted(async () => {
<component :is="iconMap.close" /> <component :is="iconMap.close" />
</NcButton> </NcButton>
</div> </div>
<NcButton v-if="false" class="mt-2" size="small" type="secondary" @click="addCalendarRange"> <NcButton class="mt-2" size="small" type="secondary" @click="addCalendarRange">
<component :is="iconMap.plus" /> <component :is="iconMap.plus" />
Add another date field Add another date field
</NcButton> </NcButton>
</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 class="!text-5xl text-orange-500" icon="warning" /> <GeneralIcon class="!text-5xl text-orange-500" icon="warning" />

1
packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

@ -742,6 +742,7 @@ const viewMore = (hour: dayjs.Dayjs) => {
:record="record" :record="record"
:resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')" :resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')"
color="blue" color="blue"
@resize-start="onResizeStart"
> >
<template v-if="!isRowEmpty(record, displayField)"> <template v-if="!isRowEmpty(record, displayField)">
<div <div

15
packages/nc-gui/components/smartsheet/toolbar/CalendarRange.vue

@ -93,8 +93,9 @@ const dateFieldOptions = computed<SelectProps['options']>(() => {
) )
}) })
// TODO: Add support for end date in future
// To add new calendar range // To add new calendar range
const addCalendarRange = async () => { /* const addCalendarRange = async () => {
_calendar_ranges.value.push({ _calendar_ranges.value.push({
fk_from_column_id: dateFieldOptions.value![0].value as string, fk_from_column_id: dateFieldOptions.value![0].value as string,
fk_to_column_id: null, fk_to_column_id: null,
@ -110,7 +111,7 @@ const removeRange = async (id: number) => {
const saveCalendarRange = async (range: CalendarRangeType, value?) => { const saveCalendarRange = async (range: CalendarRangeType, value?) => {
range.fk_to_column_id = value range.fk_to_column_id = value
await saveCalendarRanges() await saveCalendarRanges()
} } */
</script> </script>
<template> <template>
@ -148,9 +149,9 @@ const saveCalendarRange = async (range: CalendarRangeType, value?) => {
@change="saveCalendarRanges" @change="saveCalendarRanges"
> >
<a-select-option <a-select-option
v-for="(option, opId) in [...dateFieldOptions].filter((r) => { v-for="(option, opId) in [...(dateFieldOptions ?? [])].filter((r) => {
if (id === 0) return true if (id === 0) return true
const firstRange = dateFieldOptions.find((f) => f.value === calendarRange[0].fk_from_column_id) const firstRange = (dateFieldOptions ?? []).find((f) => f.value === calendarRange[0].fk_from_column_id)
return firstRange?.uidt === r.uidt return firstRange?.uidt === r.uidt
})" })"
:key="opId" :key="opId"
@ -166,8 +167,10 @@ const saveCalendarRange = async (range: CalendarRangeType, value?) => {
</a-select-option> </a-select-option>
</NcSelect> </NcSelect>
<!--
TODO: Add support for end date and multiple range in future
<div <div
v-if="range.fk_to_column_id === null && isEeUI && false" v-if="range.fk_to_column_id === null && isEeUI"
class="flex cursor-pointer flex text-gray-800 items-center gap-1" class="flex cursor-pointer flex text-gray-800 items-center gap-1"
data-testid="nc-calendar-range-add-end-date" data-testid="nc-calendar-range-add-end-date"
@click="saveCalendarRange(range, undefined)" @click="saveCalendarRange(range, undefined)"
@ -225,6 +228,8 @@ const saveCalendarRange = async (range: CalendarRangeType, value?) => {
<component :is="iconMap.plus" /> <component :is="iconMap.plus" />
Add another date field Add another date field
</NcButton> </NcButton>
-->
</div>
</div> </div>
</template> </template>
</NcDropdown> </NcDropdown>

1
packages/nc-gui/layouts/shared-view.vue

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { iconMap, onMounted, useEventListener, useGlobal, useRouter, useSharedView } from '#imports' import { iconMap, onMounted, useEventListener, useGlobal, useRouter, useSharedView } from '#imports'
const { isLoading, appInfo } = useGlobal() const { isLoading, appInfo } = useGlobal()

Loading…
Cancel
Save