diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 3dc425b7c1..96d9128b2b 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -69,6 +69,8 @@ const meta = toRef(props, 'meta') const islastRow = toRef(props, 'lastRow') +const isFirstRow = toRef(props,'firstRow') + const route = useRoute() const router = useRouter() @@ -122,6 +124,7 @@ const { syncLTARRefs, save: _save, loadCommentsAndLogs, + clearColumns, } = useProvideExpandedFormStore(meta, row) const duplicatingRowInProgress = ref(false) @@ -189,15 +192,20 @@ const isPreventChangeModalOpen = ref(false) const isCloseModalOpen = ref(false) const discardPreventModal = () => { + // when user click on next or previous button if (isPreventChangeModalOpen.value) { emits('next') + if (_row.value?.rowMeta?.new) emits('cancel') isPreventChangeModalOpen.value = false } + // when user click on close button if (isCloseModalOpen.value) { isCloseModalOpen.value = false if (_row.value?.rowMeta?.new) emits('cancel') isExpanded.value = false } + // clearing all new modifed change on close + clearColumns() } const onNext = async () => { @@ -419,7 +427,7 @@ export default {
{ @@ -195,6 +196,19 @@ const goToNextRow = () => { navigateToSiblingRow(NavigateDir.NEXT) } + +const goToPreviousRow = () => { + const currentIndex = getExpandedRowIndex() + /* when first index of current page is reached and then clicked back + previos page should be loaded + */ + if (!paginationData.value.isFirstPage && currentIndex === 1) { + const nextPage = paginationData.value?.page ? paginationData.value?.page - 1 : 1 + changePage(nextPage) + } + + navigateToSiblingRow(NavigateDir.PREV) +}