From 1c6ef42c8987eb29f50b661e99e9652f153df68d Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Wed, 27 Nov 2024 10:36:24 +0000 Subject: [PATCH] feat: enable date field for calendar --- packages/nc-gui/components/dlg/ViewCreate.vue | 45 +++++++++---- .../smartsheet/calendar/DayView/DateField.vue | 11 ++-- .../smartsheet/toolbar/Calendar/Range.vue | 65 ++++++++++++------- .../composables/useBetaFeatureToggle.ts | 2 +- 4 files changed, 81 insertions(+), 42 deletions(-) diff --git a/packages/nc-gui/components/dlg/ViewCreate.vue b/packages/nc-gui/components/dlg/ViewCreate.vue index 9de6d7d4d4..f29328018f 100644 --- a/packages/nc-gui/components/dlg/ViewCreate.vue +++ b/packages/nc-gui/components/dlg/ViewCreate.vue @@ -533,6 +533,25 @@ const isCalendarReadonly = (calendarRange?: Array<{ fk_from_column_id: string; f }) } +const isDisabled = computed(() => { + return ( + viewSelectFieldOptions.value.find((f) => f.value === form.calendar_range[0]?.fk_from_column_id)?.uidt === UITypes.DateTime && + !isRangeEnabled.value + ) +}) + +const onValueChange = async () => { + form.calendar_range = form.calendar_range.map((range, i) => { + if (i === 0) { + return { + fk_from_column_id: range.fk_from_column_id, + fk_to_column_id: null, + } + } + return range + }) +} + const predictViews = async (): Promise => { const viewType = !isAIViewCreateMode.value && form.type && viewTypeToStringMap[form.type] ? viewTypeToStringMap[form.type] : undefined @@ -999,6 +1018,7 @@ const getPluralName = (name: string) => { :placeholder="$t('placeholder.notSelected')" data-testid="nc-calendar-range-from-field-select" @click.stop + @change="onValueChange" > {
- -
- - {{ $t('activity.endDate') }} -
-
+ + +
+ + {{ $t('activity.endDate') }} +
+
+ +
-