|
|
@ -1,18 +1,24 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import * as XLSX from 'xlsx' |
|
|
|
import * as XLSX from 'xlsx' |
|
|
|
import { ExportTypes } from 'nocodb-sdk' |
|
|
|
// todo: export types is missing EXCEL |
|
|
|
|
|
|
|
// import { ExportTypes } from 'nocodb-sdk' |
|
|
|
import FileSaver from 'file-saver' |
|
|
|
import FileSaver from 'file-saver' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { useNuxtApp } from '#app' |
|
|
|
import { |
|
|
|
import { useProject } from '#imports' |
|
|
|
ActiveViewInj, |
|
|
|
import { ActiveViewInj, MetaInj } from '~/context' |
|
|
|
MetaInj, |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils' |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
import MdiFlashIcon from '~icons/mdi/flash-outline' |
|
|
|
inject, |
|
|
|
import MdiMenuDownIcon from '~icons/mdi/menu-down' |
|
|
|
ref, |
|
|
|
import MdiDownloadIcon from '~icons/mdi/download-outline' |
|
|
|
useNuxtApp, |
|
|
|
import MdiUploadIcon from '~icons/mdi/upload-outline' |
|
|
|
useProject, |
|
|
|
import MdiHookIcon from '~icons/mdi/hook' |
|
|
|
useUIPermission, |
|
|
|
import MdiViewListIcon from '~icons/mdi/view-list-outline' |
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum ExportTypes { |
|
|
|
|
|
|
|
EXCEL = 'excel', |
|
|
|
|
|
|
|
CSV = 'csv', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const sharedViewListDlg = ref(false) |
|
|
|
const sharedViewListDlg = ref(false) |
|
|
|
|
|
|
|
|
|
|
@ -22,14 +28,6 @@ const isView = false |
|
|
|
|
|
|
|
|
|
|
|
// TODO: pending for shared view |
|
|
|
// TODO: pending for shared view |
|
|
|
|
|
|
|
|
|
|
|
// interface Props { |
|
|
|
|
|
|
|
// publicViewId?: string |
|
|
|
|
|
|
|
// queryParams?: Record<string, any> |
|
|
|
|
|
|
|
// reqPayload?: Record<string, any> |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const { publicViewId, queryParams, reqPayload } = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { project } = useProject() |
|
|
|
const { project } = useProject() |
|
|
|
|
|
|
|
|
|
|
|
const { $api } = useNuxtApp() |
|
|
|
const { $api } = useNuxtApp() |
|
|
@ -44,7 +42,7 @@ const quickImportDialog = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
|
|
|
|
|
|
|
|
|
const exportFile = async (exportType: ExportTypes.EXCEL | ExportTypes.CSV) => { |
|
|
|
const exportFile = async (exportType: ExportTypes) => { |
|
|
|
let offset = 0 |
|
|
|
let offset = 0 |
|
|
|
let c = 1 |
|
|
|
let c = 1 |
|
|
|
const responseType = exportType === ExportTypes.EXCEL ? 'base64' : 'blob' |
|
|
|
const responseType = exportType === ExportTypes.EXCEL ? 'base64' : 'blob' |
|
|
@ -114,52 +112,59 @@ const exportFile = async (exportType: ExportTypes.EXCEL | ExportTypes.CSV) => { |
|
|
|
<a-dropdown> |
|
|
|
<a-dropdown> |
|
|
|
<a-button v-t="['c:actions']" class="nc-actions-menu-btn nc-toolbar-btn"> |
|
|
|
<a-button v-t="['c:actions']" class="nc-actions-menu-btn nc-toolbar-btn"> |
|
|
|
<div class="flex gap-1 align-center"> |
|
|
|
<div class="flex gap-1 align-center"> |
|
|
|
<MdiFlashIcon /> |
|
|
|
<MdiFlashOutline /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- More --> |
|
|
|
<!-- More --> |
|
|
|
<span class="!text-sm font-weight-medium">{{ $t('general.more') }}</span> |
|
|
|
<span class="!text-sm font-weight-medium">{{ $t('general.more') }}</span> |
|
|
|
<MdiMenuDownIcon class="text-grey" /> |
|
|
|
|
|
|
|
|
|
|
|
<MdiMenuDown class="text-grey" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
|
|
|
|
|
|
|
|
<template #overlay> |
|
|
|
<template #overlay> |
|
|
|
<div class="bg-white shadow-lg !border"> |
|
|
|
<div class="bg-white shadow-lg !border"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<div v-t="['a:actions:download-csv']" class="nc-menu-item" @click="exportFile(ExportTypes.CSV)"> |
|
|
|
<div v-t="['a:actions:download-csv']" class="nc-menu-item" @click="exportFile(ExportTypes.CSV)"> |
|
|
|
<MdiDownloadIcon /> |
|
|
|
<MdiDownloadOutline /> |
|
|
|
<!-- Download as CSV --> |
|
|
|
<!-- Download as CSV --> |
|
|
|
{{ $t('activity.downloadCSV') }} |
|
|
|
{{ $t('activity.downloadCSV') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div v-t="['a:actions:download-excel']" class="nc-menu-item" @click="exportFile(ExportTypes.EXCEL)"> |
|
|
|
<div v-t="['a:actions:download-excel']" class="nc-menu-item" @click="exportFile(ExportTypes.EXCEL)"> |
|
|
|
<MdiDownloadIcon /> |
|
|
|
<MdiDownloadOutline /> |
|
|
|
<!-- Download as XLSX --> |
|
|
|
<!-- Download as XLSX --> |
|
|
|
{{ $t('activity.downloadExcel') }} |
|
|
|
{{ $t('activity.downloadExcel') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="isUIAllowed('csvImport') && !isView" |
|
|
|
v-if="isUIAllowed('csvImport') && !isView" |
|
|
|
v-t="['a:actions:upload-csv']" |
|
|
|
v-t="['a:actions:upload-csv']" |
|
|
|
class="nc-menu-item" |
|
|
|
class="nc-menu-item" |
|
|
|
@click="quickImportDialog = true" |
|
|
|
@click="quickImportDialog = true" |
|
|
|
> |
|
|
|
> |
|
|
|
<MdiUploadIcon /> |
|
|
|
<MdiUploadOutline /> |
|
|
|
<!-- Upload CSV --> |
|
|
|
<!-- Upload CSV --> |
|
|
|
{{ $t('activity.uploadCSV') }} |
|
|
|
{{ $t('activity.uploadCSV') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="isUIAllowed('SharedViewList') && !isView" |
|
|
|
v-if="isUIAllowed('SharedViewList') && !isView" |
|
|
|
v-t="['a:actions:shared-view-list']" |
|
|
|
v-t="['a:actions:shared-view-list']" |
|
|
|
class="nc-menu-item" |
|
|
|
class="nc-menu-item" |
|
|
|
@click="sharedViewListDlg = true" |
|
|
|
@click="sharedViewListDlg = true" |
|
|
|
> |
|
|
|
> |
|
|
|
<MdiViewListIcon /> |
|
|
|
<MdiViewListOutline /> |
|
|
|
<!-- Shared View List --> |
|
|
|
<!-- Shared View List --> |
|
|
|
{{ $t('activity.listSharedView') }} |
|
|
|
{{ $t('activity.listSharedView') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="isUIAllowed('webhook') && !isView" |
|
|
|
v-if="isUIAllowed('webhook') && !isView" |
|
|
|
v-t="['c:actions:webhook']" |
|
|
|
v-t="['c:actions:webhook']" |
|
|
|
class="nc-menu-item" |
|
|
|
class="nc-menu-item" |
|
|
|
@click="showWebhookDrawer = true" |
|
|
|
@click="showWebhookDrawer = true" |
|
|
|
> |
|
|
|
> |
|
|
|
<MdiHookIcon /> |
|
|
|
<MdiHook /> |
|
|
|
{{ $t('objects.webhooks') }} |
|
|
|
{{ $t('objects.webhooks') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -168,6 +173,7 @@ const exportFile = async (exportType: ExportTypes.EXCEL | ExportTypes.CSV) => { |
|
|
|
</a-dropdown> |
|
|
|
</a-dropdown> |
|
|
|
|
|
|
|
|
|
|
|
<DlgQuickImport v-if="quickImportDialog" v-model="quickImportDialog" import-type="csv" :import-only="true" /> |
|
|
|
<DlgQuickImport v-if="quickImportDialog" v-model="quickImportDialog" import-type="csv" :import-only="true" /> |
|
|
|
|
|
|
|
|
|
|
|
<WebhookDrawer v-if="showWebhookDrawer" v-model="showWebhookDrawer" /> |
|
|
|
<WebhookDrawer v-if="showWebhookDrawer" v-model="showWebhookDrawer" /> |
|
|
|
|
|
|
|
|
|
|
|
<a-modal v-model:visible="sharedViewListDlg" title="Shared view list" width="max(900px,60vw)" :footer="null"> |
|
|
|
<a-modal v-model:visible="sharedViewListDlg" title="Shared view list" width="max(900px,60vw)" :footer="null"> |
|
|
|