Browse Source

Merge pull request #5455 from khisby/develop

feat(nc-gui): add check all on action column editor import modal
pull/5461/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
1089295c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      packages/nc-gui/components/template/Editor.vue
  2. 3
      packages/nc-gui/components/template/utils.ts

16
packages/nc-gui/components/template/Editor.vue

@ -3,6 +3,7 @@ import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc' import utc from 'dayjs/plugin/utc'
import type { ColumnType, TableType } from 'nocodb-sdk' import type { ColumnType, TableType } from 'nocodb-sdk'
import { UITypes, isSystemColumn, isVirtualCol } from 'nocodb-sdk' import { UITypes, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import type { CheckboxChangeEvent } from 'ant-design-vue/es/checkbox/interface'
import { srcDestMappingColumns, tableColumns } from './utils' import { srcDestMappingColumns, tableColumns } from './utils'
import { import {
Empty, Empty,
@ -87,6 +88,8 @@ const isImporting = ref(false)
const importingTips = ref<Record<string, string>>({}) const importingTips = ref<Record<string, string>>({})
const checkAllRecord = ref<boolean[]>([])
const uiTypeOptions = ref<Option[]>( const uiTypeOptions = ref<Option[]>(
(Object.keys(UITypes) as (keyof typeof UITypes)[]) (Object.keys(UITypes) as (keyof typeof UITypes)[])
.filter( .filter(
@ -615,6 +618,13 @@ function handleEditableTnChange(idx: number) {
function isSelectDisabled(uidt: string, disableSelect = false) { function isSelectDisabled(uidt: string, disableSelect = false) {
return (uidt === UITypes.SingleSelect || uidt === UITypes.MultiSelect) && disableSelect return (uidt === UITypes.SingleSelect || uidt === UITypes.MultiSelect) && disableSelect
} }
function handleCheckAllRecord(event: CheckboxChangeEvent, tableName: string) {
const isChecked = event.target.checked
for (const record of srcDestMapping.value[tableName]) {
record.enabled = isChecked
}
}
</script> </script>
<template> <template>
@ -671,6 +681,12 @@ function isSelectDisabled(uidt: string, disableSelect = false) {
<span v-if="column.key === 'source_column' || column.key === 'destination_column'"> <span v-if="column.key === 'source_column' || column.key === 'destination_column'">
{{ column.name }} {{ column.name }}
</span> </span>
<span v-if="column.key === 'action'">
<a-checkbox
v-model:checked="checkAllRecord[table.table_name]"
@change="handleCheckAllRecord($event, table.table_name)"
/>
</span>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">

3
packages/nc-gui/components/template/utils.ts

@ -40,6 +40,7 @@ export const srcDestMappingColumns: (Omit<ColumnGroupType<any>, 'children'> & {
{ {
name: 'Action', name: 'Action',
key: 'action', key: 'action',
align: 'right', align: 'center',
width: 50,
}, },
] ]

Loading…
Cancel
Save