diff --git a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue index 9e9402fbc5..5f647286b3 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue @@ -13,13 +13,9 @@ import { ref, storeToRefs, useBase, - useI18n, useNuxtApp, - useSmartsheetStoreOrThrow, } from '#imports' -const { t } = useI18n() - const isPublicView = inject(IsPublicInj, ref(false)) const fields = inject(FieldsInj, ref([])) @@ -33,7 +29,7 @@ const meta = inject(MetaInj, ref()) const selectedView = inject(ActiveViewInj) -const { sorts, nestedFilters } = useSmartsheetStoreOrThrow() +const { activeNestedFilters: nestedFilters, activeSorts: sorts } = storeToRefs(useViewsStore()) const isExportingType = ref(undefined) diff --git a/packages/nc-gui/composables/useSmartsheetStore.ts b/packages/nc-gui/composables/useSmartsheetStore.ts index 81763fdbb7..9f26b9de5c 100644 --- a/packages/nc-gui/composables/useSmartsheetStore.ts +++ b/packages/nc-gui/composables/useSmartsheetStore.ts @@ -15,7 +15,7 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState( ) => { const { $api } = useNuxtApp() - const { activeView: view } = storeToRefs(useViewsStore()) + const { activeView: view, activeNestedFilters, activeSorts } = storeToRefs(useViewsStore()) const baseStore = useBase() @@ -57,6 +57,26 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState( const sorts = ref(unref(initialSorts) ?? []) const nestedFilters = ref(unref(initialFilters) ?? []) + watch( + sorts, + () => { + activeSorts.value = sorts.value + }, + { + immediate: true, + }, + ) + + watch( + nestedFilters, + () => { + activeNestedFilters.value = nestedFilters.value + }, + { + immediate: true, + }, + ) + return { view, meta, diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index 5a7fdf61f2..d86ab3c6e4 100644 --- a/packages/nc-gui/lang/en.json +++ b/packages/nc-gui/lang/en.json @@ -748,8 +748,8 @@ "deleteSelectedRow": "Delete Selected Records", "importExcel": "Import Excel", "importCSV": "Import CSV", - "downloadCSV": "Download as CSV", - "downloadExcel": "Download as XLSX", + "downloadCSV": "Download CSV", + "downloadExcel": "Download Excel", "uploadCSV": "Upload CSV", "import": "Import", "importMetadata": "Import Metadata", diff --git a/packages/nc-gui/store/views.ts b/packages/nc-gui/store/views.ts index a6f9547025..ce3ca8855a 100644 --- a/packages/nc-gui/store/views.ts +++ b/packages/nc-gui/store/views.ts @@ -1,4 +1,4 @@ -import type { ViewType, ViewTypes } from 'nocodb-sdk' +import type { FilterType, SortType, ViewType, ViewTypes } from 'nocodb-sdk' import { acceptHMRUpdate, defineStore } from 'pinia' import type { ViewPageType } from '~/lib' @@ -41,6 +41,12 @@ export const useViewsStore = defineStore('viewsStore', () => { }, }) + // Both are synced with `useSmartsheetStore` state + // Sort of active view + const activeSorts = ref([]) + // Filters of active view (used for local filters) + const activeNestedFilters = ref([]) + const isViewsLoading = ref(true) const isViewDataLoading = ref(true) const isPublic = computed(() => route.value.meta?.public) @@ -304,6 +310,8 @@ export const useViewsStore = defineStore('viewsStore', () => { navigateToView, changeView, removeFromRecentViews, + activeSorts, + activeNestedFilters, } })