Browse Source

style(gui-v2): template components

pull/2828/head
Wing-Kam Wong 2 years ago
parent
commit
cc0dc6728f
  1. 50
      packages/nc-gui-v2/components/template/Editor.vue

50
packages/nc-gui-v2/components/template/Editor.vue

@ -76,6 +76,7 @@ const tableColumns = [
{ {
name: 'Action', name: 'Action',
key: 'action', key: 'action',
align: 'right',
}, },
] ]
@ -108,7 +109,7 @@ const validators = computed(() => {
const { resetFields, validate, validateInfos } = useForm(data, validators) const { resetFields, validate, validateInfos } = useForm(data, validators)
const editorTitle = computed(() => { const editorTitle = computed(() => {
return `${quickImportType.toUpperCase()} Import` return `${quickImportType.toUpperCase()} Import: ${data.title}`
}) })
onMounted(() => { onMounted(() => {
@ -315,11 +316,11 @@ const importTemplate = async () => {
</a-button> </a-button>
</template> </template>
<a-form :model="data" name="template-editor-form"> <a-form :model="data" name="template-editor-form">
<p v-if="data.tables && quickImportType === 'excel'" class="caption grey--text mt-4"> <p v-if="data.tables && quickImportType === 'excel'" class="text-center">
{{ data.tables.length }} sheet{{ data.tables.length > 1 ? 's' : '' }} {{ data.tables.length }} sheet{{ data.tables.length > 1 ? 's' : '' }}
available for import available for import
</p> </p>
<a-collapse v-if="data.tables && data.tables.length" v-model:activeKey="expansionPanel"> <a-collapse v-if="data.tables && data.tables.length" v-model:activeKey="expansionPanel" accordion>
<a-collapse-panel v-for="(table, i) in data.tables" :key="i"> <a-collapse-panel v-for="(table, i) in data.tables" :key="i">
<template #header> <template #header>
<a-form-item v-if="editableTn[i]" v-bind="validateInfos[`tables.${i}.table_name`]" noStyle> <a-form-item v-if="editableTn[i]" v-bind="validateInfos[`tables.${i}.table_name`]" noStyle>
@ -332,9 +333,8 @@ const importTemplate = async () => {
@keydown.enter="setEditableTn(i, false)" @keydown.enter="setEditableTn(i, false)"
/> />
</a-form-item> </a-form-item>
<span v-else class="font-weight-bold text-lg" @click="(e) => (e.stopPropagation(), setEditableTn(i, true))">
<span v-else class="font-weight-bold" @click="(e) => (e.stopPropagation(), setEditableTn(i, true))"> <MdiTableIcon style="margin-bottom: -5px" />
<MdiTableIcon />
{{ table.table_name }} {{ table.table_name }}
</span> </span>
</template> </template>
@ -344,10 +344,24 @@ const importTemplate = async () => {
<!-- TODO: i18n --> <!-- TODO: i18n -->
<span>Delete Table</span> <span>Delete Table</span>
</template> </template>
<MdiDeleteOutlineIcon v-if="data.tables.length > 1" @click.stop="deleteTable(i)" /> <MdiDeleteOutlineIcon
v-if="data.tables.length > 1"
class="text-lg"
style="margin-right: 30px"
@click.stop="deleteTable(i)"
/>
</a-tooltip> </a-tooltip>
</template> </template>
<a-table v-if="table.columns.length" :dataSource="table.columns" :columns="tableColumns" :pagination="false">
<a-table
v-if="table.columns.length"
class="template-form"
size="middle"
row-class-name="template-form-row"
:data-source="table.columns"
:columns="tableColumns"
:pagination="false"
>
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.key === 'column_name'"> <template v-if="column.key === 'column_name'">
<span> <span>
@ -391,18 +405,16 @@ const importTemplate = async () => {
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-tooltip v-if="record.key == 0" bottom> <a-tooltip v-if="record.key === 0">
<template #title> <template #title>
<!-- TODO: i18n --> <!-- TODO: i18n -->
<span>Primary Value</span> <span>Primary Value</span>
</template> </template>
<a-button type="text" disabled> <span style="margin-right: 15px">
<div class="flex items-center"> <MdiKeyStarIcon class="text-lg" />
<MdiKeyStarIcon /> </span>
</div>
</a-button>
</a-tooltip> </a-tooltip>
<a-tooltip v-else bottom> <a-tooltip v-else>
<template #title> <template #title>
<!-- TODO: i18n --> <!-- TODO: i18n -->
<span>Delete Column</span> <span>Delete Column</span>
@ -410,7 +422,7 @@ const importTemplate = async () => {
<a-button @click="deleteTableColumn(i, record.key, record, table)" type="text"> <a-button @click="deleteTableColumn(i, record.key, record, table)" type="text">
<div class="flex items-center"> <div class="flex items-center">
<MdiDeleteOutlineIcon /> <MdiDeleteOutlineIcon class="text-lg" />
</div> </div>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
@ -474,3 +486,9 @@ const importTemplate = async () => {
</a-form> </a-form>
</a-card> </a-card>
</template> </template>
<style scoped>
.template-form :deep(.template-form-row) > td {
padding-bottom: 0px !important;
}
</style>

Loading…
Cancel
Save