diff --git a/packages/nc-gui/components/dlg/ViewCreate.vue b/packages/nc-gui/components/dlg/ViewCreate.vue index 78e4bcf2ab..1bdda014e3 100644 --- a/packages/nc-gui/components/dlg/ViewCreate.vue +++ b/packages/nc-gui/components/dlg/ViewCreate.vue @@ -285,6 +285,7 @@ onMounted(async () => { return { value: field.id, label: field.title, + uidt: field.uidt, } }) @@ -461,7 +462,11 @@ onMounted(async () => { v-model:value="range.fk_to_column_id" :disabled="isMetaLoading" :loading="isMetaLoading" - :options="viewSelectFieldOptions" + :options=" + viewSelectFieldOptions.filter( + (el) => el.uidt === viewSelectFieldOptions.find((el) => el.id === range.fk_from_column_id), + ) + " :placeholder="$t('placeholder.notSelected')" class="w-full" /> diff --git a/packages/nc-gui/components/nc/DateWeekSelector.vue b/packages/nc-gui/components/nc/DateWeekSelector.vue index c7d9d763da..70e89b5e2f 100644 --- a/packages/nc-gui/components/nc/DateWeekSelector.vue +++ b/packages/nc-gui/components/nc/DateWeekSelector.vue @@ -16,7 +16,7 @@ interface Props { const props = withDefaults(defineProps(), { selectedDate: null, isDisabled: false, - isMondayFirst: false, + isMondayFirst: true, pageDate: new Date(), weekPicker: false, disablePagination: false, diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView.vue b/packages/nc-gui/components/smartsheet/calendar/DayView.vue index 756a112a07..55fb045565 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView.vue @@ -1,38 +1,76 @@ - - + diff --git a/packages/nc-gui/components/smartsheet/calendar/SideMenu.vue b/packages/nc-gui/components/smartsheet/calendar/SideMenu.vue index 33ec2d7d59..13b7eab96d 100644 --- a/packages/nc-gui/components/smartsheet/calendar/SideMenu.vue +++ b/packages/nc-gui/components/smartsheet/calendar/SideMenu.vue @@ -1,14 +1,10 @@ - - + diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView.vue new file mode 100644 index 0000000000..791aece31a --- /dev/null +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/packages/nc-gui/components/smartsheet/calendar/index.vue b/packages/nc-gui/components/smartsheet/calendar/index.vue index 69c6b195e1..9ffee632ef 100644 --- a/packages/nc-gui/components/smartsheet/calendar/index.vue +++ b/packages/nc-gui/components/smartsheet/calendar/index.vue @@ -9,6 +9,11 @@ import { IsGridInj, IsKanbanInj, MetaInj, + ReloadViewDataHookInj, + ReloadViewMetaHookInj, + type Row as RowType, + computed, + extractPkFromRow, inject, provide, ref, @@ -19,6 +24,9 @@ const meta = inject(MetaInj, ref()) const view = inject(ActiveViewInj, ref()) +const reloadViewMetaHook = inject(ReloadViewMetaHookInj) +const reloadViewDataHook = inject(ReloadViewDataHookInj) + const { isMobileMode } = useGlobal() const { t } = useI18n() @@ -36,6 +44,8 @@ provide(IsCalendarInj, ref(true)) const { formattedData, loadCalendarMeta, + loadCalendarData, + isCalendarDataLoading, updateCalendarMeta, calendarMetaData, selectedDate, @@ -50,15 +60,58 @@ provide(CalendarViewTypeInj, activeCalendarView) const showSideMenu = ref(true) -const isExpanded = ref(false) +const expandedFormOnRowIdDlg = computed({ + get() { + return !!route.query.rowId + }, + set(val) { + if (!val) + router.push({ + query: { + ...route.query, + rowId: undefined, + }, + }) + }, +}) + +const expandedFormDlg = ref(false) +const expandedFormRow = ref() +const expandedFormRowState = ref>() + +const router = useRouter() +const route = useRoute() -const expandedRecordId = ref(null) +const expandRecord = (row: RowType) => { + const rowId = extractPkFromRow(row.row, meta.value!.columns!) -const expandRecord = (id: string) => { - isExpanded.value = true - expandedRecordId.value = id + if (rowId) { + router.push({ + query: { + ...route.query, + rowId, + }, + }) + } else { + expandedFormRow.value = row + expandedFormRowState.value = state + expandedFormDlg.value = true + } } +onMounted(async () => { + await loadCalendarMeta() + await loadCalendarData() +}) + +reloadViewMetaHook?.on(async () => { + await loadCalendarMeta() + await loadCalendarData() +}) +reloadViewDataHook?.on(async () => { + await loadCalendarData() +}) + const headerText = computed(() => { switch (activeCalendarView.value) { case 'day': @@ -83,7 +136,7 @@ const headerText = computed(() => { - {{ headerText }} + {{ headerText }} @@ -98,22 +151,39 @@ const headerText = computed(() => { /> - - - + +
+ +
- + + + diff --git a/packages/nc-gui/components/smartsheet/toolbar/CalendarMode.vue b/packages/nc-gui/components/smartsheet/toolbar/CalendarMode.vue index 934d438fb9..c891dee8c8 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/CalendarMode.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/CalendarMode.vue @@ -10,11 +10,18 @@ const setActiveCalendarMode = (mode: 'day' | 'week' | 'month' | 'year', event: M const tabElement = event.target as HTMLElement highlightStyle.value.left = `${tabElement.offsetLeft}px` } + +onMounted(() => { + const activeTab = document.querySelector('.nc-calendar-mode-tab .tab.active') as HTMLElement + if (activeTab) { + highlightStyle.value.left = `${activeTab.offsetLeft}px` + } +})