From 430a50ed710224b0afbda464954dd983a502f950 Mon Sep 17 00:00:00 2001 From: Wonkeun No Date: Fri, 14 Oct 2022 14:32:44 -0400 Subject: [PATCH 001/134] Add an argument to ROUND func to show decimal numbers --- packages/nc-gui/utils/formulaUtils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/utils/formulaUtils.ts b/packages/nc-gui/utils/formulaUtils.ts index 63b89a94e2..9b084ce6b0 100644 --- a/packages/nc-gui/utils/formulaUtils.ts +++ b/packages/nc-gui/utils/formulaUtils.ts @@ -176,12 +176,12 @@ const formulas: Record = { type: formulaTypes.NUMERIC, validation: { args: { - rqd: 1, + rqd: 2, }, }, - description: 'Nearest integer to the input parameter', - syntax: 'ROUND(value)', - examples: ['ROUND(3.1415) => 3', 'ROUND({column1})'], + description: 'Rounded number to a specified number of decimal places', + syntax: 'ROUND(value, decimals)', + examples: ['ROUND(3.1415,2) => 3.14', 'ROUND({column1}, 3)'], }, MOD: { type: formulaTypes.NUMERIC, From 3c6c34adc07701a00928df023138e31ff2141ea2 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 17 Oct 2022 11:41:35 +0800 Subject: [PATCH 002/134] refactor(nc-gui): pass tableIdx instead of passing table to addNewColumnRow --- .../nc-gui/components/template/Editor.vue | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/components/template/Editor.vue b/packages/nc-gui/components/template/Editor.vue index 023216ec71..f6c403fb49 100644 --- a/packages/nc-gui/components/template/Editor.vue +++ b/packages/nc-gui/components/template/Editor.vue @@ -97,7 +97,7 @@ const srcDestMapping = ref[]>([]) const data = reactive<{ title: string | null name: string - tables: (TableType & { ref_table_name: string; columns: (ColumnType & { _disableSelect?: boolean })[] })[] + tables: (TableType & { ref_table_name: string; columns: (ColumnType & { key: number; _disableSelect?: boolean })[] })[] }>({ title: null, name: 'Project Name', @@ -206,15 +206,15 @@ function deleteTableColumn(tableIdx: number, columnIdx: number) { data.tables[tableIdx].columns?.splice(columnIdx, 1) } -function addNewColumnRow(table: Record, uidt?: string) { - table.columns.push({ - key: table.columns.length, - column_name: `title${table.columns.length + 1}`, +function addNewColumnRow(tableIdx: number, uidt: string) { + data.tables[tableIdx].columns.push({ + key: data.tables[tableIdx].columns.length + 1, + column_name: `title${data.tables[tableIdx].columns.length + 1}`, uidt, }) nextTick(() => { - const input = inputRefs.value[table.columns.length - 1] + const input = inputRefs.value[data.tables[tableIdx].columns.length - 1] input.focus() input.select() @@ -794,7 +794,7 @@ function isSelectDisabled(uidt: string, disableSelect = false) { Add Number Column - +
@@ -807,7 +807,7 @@ function isSelectDisabled(uidt: string, disableSelect = false) { Add SingleLineText Column - +
@@ -820,7 +820,7 @@ function isSelectDisabled(uidt: string, disableSelect = false) { Add LongText Column - +
@@ -833,7 +833,7 @@ function isSelectDisabled(uidt: string, disableSelect = false) { Add Other Column - +
From 0e2fcd5f3a0487731e2ba8952d38c6db32d1fca0 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 17 Oct 2022 11:51:31 +0800 Subject: [PATCH 003/134] fix(nc-gui): incorrect focus when adding a new column during import useTemplateRefsList will not reset the existing refs. It appends new refs everytime a new column is added. --- packages/nc-gui/components/template/Editor.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/template/Editor.vue b/packages/nc-gui/components/template/Editor.vue index f6c403fb49..dbf6dabfed 100644 --- a/packages/nc-gui/components/template/Editor.vue +++ b/packages/nc-gui/components/template/Editor.vue @@ -25,7 +25,6 @@ import { useNuxtApp, useProject, useTabs, - useTemplateRefsList, } from '#imports' import { TabType } from '~/lib' @@ -71,7 +70,7 @@ const expansionPanel = ref([]) const editableTn = ref([]) -const inputRefs = useTemplateRefsList() +const inputRefs = ref([]) const isImporting = ref(false) @@ -208,14 +207,13 @@ function deleteTableColumn(tableIdx: number, columnIdx: number) { function addNewColumnRow(tableIdx: number, uidt: string) { data.tables[tableIdx].columns.push({ - key: data.tables[tableIdx].columns.length + 1, + key: data.tables[tableIdx].columns.length, column_name: `title${data.tables[tableIdx].columns.length + 1}`, uidt, }) nextTick(() => { const input = inputRefs.value[data.tables[tableIdx].columns.length - 1] - input.focus() input.select() }) @@ -723,7 +721,14 @@ function isSelectDisabled(uidt: string, disableSelect = false) { diff --git a/packages/nc-gui/composables/useExpandedFormDetached/index.ts b/packages/nc-gui/composables/useExpandedFormDetached/index.ts index c2bda1c78d..2aef11da08 100644 --- a/packages/nc-gui/composables/useExpandedFormDetached/index.ts +++ b/packages/nc-gui/composables/useExpandedFormDetached/index.ts @@ -1,5 +1,5 @@ import type { TableType, ViewType } from 'nocodb-sdk' -import { ref, useInjectionState } from '#imports' +import { createEventHook, ref, useInjectionState } from '#imports' import type { Row } from '~/lib' interface UseExpandedFormDetachedProps { @@ -26,6 +26,8 @@ export function useExpandedFormDetached() { states = setup() } + const closeHook = createEventHook() + const index = ref(-1) const open = (props: UseExpandedFormDetachedProps) => { @@ -33,9 +35,10 @@ export function useExpandedFormDetached() { index.value = states.value.length - 1 } - const close = () => { - states.value.splice(index.value, 1) + const close = (i?: number) => { + states.value.splice(i || index.value, 1) + if (index.value === i || !i) closeHook.trigger() } - return { states, open, close } + return { states, open, close, onClose: closeHook.on } } From 952a32c327e902576c28cf3209bedbf91d6035d0 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 11:59:39 +0800 Subject: [PATCH 057/134] feat(nc-gui): skip empty lines when parsing --- packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts index 723583f05e..fc42bc2b4c 100644 --- a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts +++ b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts @@ -205,6 +205,7 @@ export default class CSVTemplateAdapter { let steppers = 0 const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() parse(file.originFileObj as File, { + worker: true, skipEmptyLines: 'greedy', step(row) { steppers += 1 @@ -256,6 +257,7 @@ export default class CSVTemplateAdapter { if (this.config.importData) { parse(file.originFileObj as File, { worker: true, + skipEmptyLines: 'greedy', step(row) { steppers += 1 if (row && steppers >= +that.config.firstRowAsHeaders + 1) { From 5e412f15a5cc498b14a0808a926b23d3dffbe6c1 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 13:54:57 +0800 Subject: [PATCH 058/134] feat(nc-gui): validate each table after pre-import --- .../nc-gui/components/template/Editor.vue | 97 +++++++++---------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/packages/nc-gui/components/template/Editor.vue b/packages/nc-gui/components/template/Editor.vue index f59b758dd6..3b5dafcb54 100644 --- a/packages/nc-gui/components/template/Editor.vue +++ b/packages/nc-gui/components/template/Editor.vue @@ -290,8 +290,6 @@ function fieldsValidation(record: Record) { return true } - const tableName = meta.value?.title || '' - if (!record.destCn) { message.error(`${t('msg.error.columnDescriptionNotFound')} ${record.srcCn}`) return false @@ -304,63 +302,62 @@ function fieldsValidation(record: Record) { const v = columns.value.find((c) => c.title === record.destCn) as Record - // check if the input contains null value for a required column - if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) { - if ( - importData[tableName] - .slice(0, maxRowsToParse) - .some((r: Record) => r[record.srcCn] === null || r[record.srcCn] === undefined || r[record.srcCn] === '') - ) { - message.error(t('msg.error.nullValueViolatesNotNull')) - } - } - - switch (v.uidt) { - case UITypes.Number: + for (const tableName of Object.keys(importData)) { + // check if the input contains null value for a required column + if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) { if ( importData[tableName] .slice(0, maxRowsToParse) - .some( - (r: Record) => r[record.sourceCn] !== null && r[record.srcCn] !== undefined && isNaN(+r[record.srcCn]), - ) + .some((r: Record) => r[record.srcCn] === null || r[record.srcCn] === undefined || r[record.srcCn] === '') ) { - message.error(t('msg.error.sourceHasInvalidNumbers')) - return false + message.error(t('msg.error.nullValueViolatesNotNull')) } + } - break - case UITypes.Checkbox: - if ( - importData[tableName].slice(0, maxRowsToParse).some((r: Record) => { - if (r[record.srcCn] !== null && r[record.srcCn] !== undefined) { - let input = r[record.srcCn] - if (typeof input === 'string') { - input = input.replace(/["']/g, '').toLowerCase().trim() - return !( - input === 'false' || - input === 'no' || - input === 'n' || - input === '0' || - input === 'true' || - input === 'yes' || - input === 'y' || - input === '1' - ) - } + switch (v.uidt) { + case UITypes.Number: + if ( + importData[tableName] + .slice(0, maxRowsToParse) + .some( + (r: Record) => r[record.sourceCn] !== null && r[record.srcCn] !== undefined && isNaN(+r[record.srcCn]), + ) + ) { + message.error(t('msg.error.sourceHasInvalidNumbers')) + return false + } - return input !== 1 && input !== 0 && input !== true && input !== false - } + break + case UITypes.Checkbox: + if ( + importData[tableName].slice(0, maxRowsToParse).some((r: Record) => { + if (r[record.srcCn] !== null && r[record.srcCn] !== undefined) { + let input = r[record.srcCn] + if (typeof input === 'string') { + input = input.replace(/["']/g, '').toLowerCase().trim() + return !( + input === 'false' || + input === 'no' || + input === 'n' || + input === '0' || + input === 'true' || + input === 'yes' || + input === 'y' || + input === '1' + ) + } + return input !== 1 && input !== 0 && input !== true && input !== false + } + return false + }) + ) { + message.error(t('msg.error.sourceHasInvalidBoolean')) return false - }) - ) { - message.error(t('msg.error.sourceHasInvalidBoolean')) - - return false - } - break + } + break + } } - return true } @@ -541,7 +538,7 @@ function mapDefaultColumns() { for (const col of importColumns[0]) { const o = { srcCn: col.column_name, destCn: '', enabled: true } if (columns.value) { - const tableColumn = columns.value.find((c: Record) => c.title === col.column_name) + const tableColumn = columns.value.find((c) => c.column_name === col.column_name) if (tableColumn) { o.destCn = tableColumn.title as string } else { From c513997014ee07beecde7ac21eb55bfacb7a3839 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 13:55:47 +0800 Subject: [PATCH 059/134] fix(nc-gui): import to existing table issue --- .../nc-gui/components/dlg/QuickImport.vue | 5 +- .../utils/parsers/CSVTemplateAdapter.ts | 80 ++++++++++--------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/packages/nc-gui/components/dlg/QuickImport.vue b/packages/nc-gui/components/dlg/QuickImport.vue index 624d4e5342..b1d5ed31e4 100644 --- a/packages/nc-gui/components/dlg/QuickImport.vue +++ b/packages/nc-gui/components/dlg/QuickImport.vue @@ -169,9 +169,7 @@ async function handleImport() { message.error(t('msg.error.templateGeneratorNotFound')) return } - importLoading.value = true - importData.value = templateGenerator.getData() await templateEditorRef.value.importTemplate() } catch (e: any) { return message.error(await extractSdkResponseErrorMsg(e)) @@ -200,7 +198,8 @@ async function parseAndExtractStreamData(val: UploadFile[]) { templateData.value = templateGenerator!.getTemplate() // TODO(import): remove // templateData.value.tables[0].table_name = populateUniqueTableName() - // if (importOnly) importColumns.value = templateGenerator.getColumns() + if (importOnly) importColumns.value = templateGenerator!.getColumns() + importData.value = templateGenerator!.getData() templateEditorModal.value = true isParsingData.value = false preImportLoading.value = false diff --git a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts index fc42bc2b4c..c2756e7b25 100644 --- a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts +++ b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts @@ -204,6 +204,9 @@ export default class CSVTemplateAdapter { for (const [tableIdx, file] of this.files.entries()) { let steppers = 0 const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() + this.data[tn] = [] + + // parse column meta parse(file.originFileObj as File, { worker: true, skipEmptyLines: 'greedy', @@ -238,53 +241,54 @@ export default class CSVTemplateAdapter { console.log('complete') console.log(`steppers: ${steppers}`) that.updateTemplate(tableIdx) - callback() + + // parse table data + if (that.config.importData) { + steppers = 0 + parse(file.originFileObj as File, { + worker: true, + skipEmptyLines: 'greedy', + step(row) { + steppers += 1 + if (row && steppers >= +that.config.firstRowAsHeaders + 1) { + const rowData: Record = {} + for (let columnIdx = 0; columnIdx < that.headers[tableIdx].length; columnIdx++) { + const column = that.project.tables[tableIdx].columns[columnIdx] + const data = (row.data as [])[columnIdx] === '' ? null : (row.data as [])[columnIdx] + if (column.uidt === UITypes.Checkbox) { + rowData[column.column_name] = getCheckboxValue(data) + rowData[column.column_name] = data + } else if (column.uidt === UITypes.SingleSelect || column.uidt === UITypes.MultiSelect) { + rowData[column.column_name] = (data || '').toString().trim() || null + } else { + // TODO(import): do parsing if necessary based on type + rowData[column.column_name] = data + } + } + that.data[tn].push(rowData) + } + }, + complete() { + console.log('getData(): complete') + console.log(`getData(): steppers: ${steppers}`) + callback() + }, + // TODO(import): add error + }) + } else { + callback() + } }, }) } } getColumns() { - // return this.columns + console.log(this.project.tables.map((t: Record) => t.columns)) + return this.project.tables.map((t: Record) => t.columns) } getData() { - const that = this - for (const [tableIdx, file] of this.files.entries()) { - let steppers = 0 - const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() - this.data[tn] = [] - if (this.config.importData) { - parse(file.originFileObj as File, { - worker: true, - skipEmptyLines: 'greedy', - step(row) { - steppers += 1 - if (row && steppers >= +that.config.firstRowAsHeaders + 1) { - const rowData: Record = {} - for (let columnIdx = 0; columnIdx < that.headers[tableIdx].length; columnIdx++) { - const column = that.project.tables[tableIdx].columns[columnIdx] - const data = (row.data as [])[columnIdx] === '' ? null : (row.data as [])[columnIdx] - if (column.uidt === UITypes.Checkbox) { - rowData[column.column_name] = getCheckboxValue(data) - rowData[column.column_name] = data - } else if (column.uidt === UITypes.SingleSelect || column.uidt === UITypes.MultiSelect) { - rowData[column.column_name] = (data || '').toString().trim() || null - } else { - // TODO(import): do parsing if necessary based on type - rowData[column.column_name] = data - } - } - that.data[tn].push(rowData) - } - }, - complete() { - console.log('getData(): complete') - console.log(`getData(): steppers: ${steppers}`) - }, - }) - } - } return this.data } From 2e3f843ee9a90286607faf50e3a9fa8423819dba Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 13:58:46 +0800 Subject: [PATCH 060/134] chore(nc-gui): remove console log --- packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts index c2756e7b25..70e85eab80 100644 --- a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts +++ b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts @@ -284,7 +284,6 @@ export default class CSVTemplateAdapter { } getColumns() { - console.log(this.project.tables.map((t: Record) => t.columns)) return this.project.tables.map((t: Record) => t.columns) } From 7f9f60b1c542aabbd720d40f51ae44d17e83b35d Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 13:59:02 +0800 Subject: [PATCH 061/134] refactor(nc-gui): merge parseAndExtractStreamData to parseAndExtractData --- .../nc-gui/components/dlg/QuickImport.vue | 37 +++---------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/packages/nc-gui/components/dlg/QuickImport.vue b/packages/nc-gui/components/dlg/QuickImport.vue index b1d5ed31e4..2b0b869c4e 100644 --- a/packages/nc-gui/components/dlg/QuickImport.vue +++ b/packages/nc-gui/components/dlg/QuickImport.vue @@ -147,7 +147,7 @@ async function handlePreImport() { if (activeKey.value === 'uploadTab') { if (isImportTypeCsv.value) { - await parseAndExtractStreamData(importState.fileList as streamImportFileList) + await parseAndExtractData(importState.fileList as streamImportFileList) } else { await parseAndExtractData((importState.fileList as importFileList)[0].data) } @@ -179,37 +179,10 @@ async function handleImport() { dialogShow.value = false } -async function parseAndExtractStreamData(val: UploadFile[]) { - try { - templateData.value = null - importData.value = null - importColumns.value = [] - - templateGenerator = getAdapter(val) - - if (!templateGenerator) { - message.error(t('msg.error.templateGeneratorNotFound')) - return - } - - await templateGenerator.init() - - templateGenerator.parse(() => { - templateData.value = templateGenerator!.getTemplate() - // TODO(import): remove - // templateData.value.tables[0].table_name = populateUniqueTableName() - if (importOnly) importColumns.value = templateGenerator!.getColumns() - importData.value = templateGenerator!.getData() - templateEditorModal.value = true - isParsingData.value = false - preImportLoading.value = false - }) - } catch (e: any) { - message.error(await extractSdkResponseErrorMsg(e)) - } -} - -async function parseAndExtractData(val: string | ArrayBuffer) { +// UploadFile[] for csv import (streaming) +// ArrayBuffer for excel import +// string for json import +async function parseAndExtractData(val: UploadFile[] | ArrayBuffer | string) { try { templateData.value = null importData.value = null From 1a29bd016640ff12f4ddae932cf18b6dac969ad3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 21 Oct 2022 15:56:40 +0800 Subject: [PATCH 062/134] 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) {