From 1a29bd016640ff12f4ddae932cf18b6dac969ad3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 15:56:40 +0800 Subject: [PATCH] refactor(nc-gui): rename variables & props --- packages/nc-gui/components/dlg/QuickImport.vue | 12 ++++++------ .../components/smartsheet/toolbar/MoreActions.vue | 2 +- .../components/smartsheet/toolbar/ViewActions.vue | 2 +- packages/nc-gui/components/template/Editor.vue | 12 ++++++------ packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts | 2 +- .../nc-gui/utils/parsers/ExcelTemplateAdapter.ts | 2 +- packages/nc-gui/utils/parsers/JSONTemplateAdapter.ts | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/nc-gui/components/dlg/QuickImport.vue b/packages/nc-gui/components/dlg/QuickImport.vue index 2b0b869c4e..f18ed5df6a 100644 --- a/packages/nc-gui/components/dlg/QuickImport.vue +++ b/packages/nc-gui/components/dlg/QuickImport.vue @@ -27,10 +27,10 @@ import type { importFileList, streamImportFileList } from '~/lib' interface Props { modelValue: boolean importType: 'csv' | 'json' | 'excel' - importOnly?: boolean + importDataOnly?: boolean } -const { importType, importOnly = false, ...rest } = defineProps() +const { importType, importDataOnly = false, ...rest } = defineProps() const emit = defineEmits(['update:modelValue']) @@ -69,7 +69,7 @@ const importState = reactive({ normalizeNested: true, autoSelectFieldTypes: true, firstRowAsHeaders: true, - importData: true, + shouldImportData: true, }, }) @@ -199,7 +199,7 @@ async function parseAndExtractData(val: UploadFile[] | ArrayBuffer | string) { templateGenerator.parse(() => { templateData.value = templateGenerator!.getTemplate() - if (importOnly) importColumns.value = templateGenerator!.getColumns() + if (importDataOnly) importColumns.value = templateGenerator!.getColumns() importData.value = templateGenerator!.getData() templateEditorModal.value = true isParsingData.value = false @@ -342,7 +342,7 @@ const beforeUpload = (file: UploadFile) => { :project-template="templateData" :import-data="importData" :import-columns="importColumns" - :import-only="importOnly" + :import-data-only="importDataOnly" :quick-import-type="importType" :max-rows-to-parse="importState.parserConfig.maxRowsToParse" class="nc-quick-import-template-editor" @@ -448,7 +448,7 @@ const beforeUpload = (file: UploadFile) => { - {{ $t('labels.importData') }} + {{ $t('labels.importData') }} diff --git a/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue b/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue index 6ef6335d71..8a6e9eb7c0 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue @@ -166,7 +166,7 @@ const exportFile = async (exportType: ExportTypes) => { - + diff --git a/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue b/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue index c926a5c3d7..daa2c857f3 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue @@ -228,7 +228,7 @@ const { isSqlView } = useSmartsheetStoreOrThrow() - + diff --git a/packages/nc-gui/components/template/Editor.vue b/packages/nc-gui/components/template/Editor.vue index 3b5dafcb54..de802d00c2 100644 --- a/packages/nc-gui/components/template/Editor.vue +++ b/packages/nc-gui/components/template/Editor.vue @@ -28,7 +28,7 @@ import { } from '#imports' import { TabType } from '~/lib' -const { quickImportType, projectTemplate, importData, importColumns, importOnly, maxRowsToParse } = defineProps() +const { quickImportType, projectTemplate, importData, importColumns, importDataOnly, maxRowsToParse } = defineProps() const emit = defineEmits(['import']) @@ -41,7 +41,7 @@ interface Props { projectTemplate: Record importData: Record importColumns: any[] - importOnly: boolean + importDataOnly: boolean maxRowsToParse: number } @@ -123,7 +123,7 @@ const validators = computed(() => const { validate, validateInfos } = useForm(data, validators) const isValid = computed(() => { - if (importOnly) { + if (importDataOnly) { for (const record of srcDestMapping.value) { if (!fieldsValidation(record)) { return false @@ -362,7 +362,7 @@ function fieldsValidation(record: Record) { } async function importTemplate() { - if (importOnly) { + if (importDataOnly) { // validate required columns if (!missingRequiredColumnsValidation()) return @@ -555,7 +555,7 @@ defineExpose({ }) onMounted(() => { - if (importOnly) { + if (importDataOnly) { mapDefaultColumns() } }) @@ -579,7 +579,7 @@ function isSelectDisabled(uidt: string, disableSelect = false) {