Browse Source

feat(gui-v2): add active row in form view

pull/3030/head
Wing-Kam Wong 2 years ago
parent
commit
2e5c63bf8b
  1. 29
      packages/nc-gui-v2/components/smartsheet/Form.vue

29
packages/nc-gui-v2/components/smartsheet/Form.vue

@ -71,6 +71,8 @@ const showColumnDropdown = ref(false)
const drag = ref(false) const drag = ref(false)
const activeRow = ref('')
const formView = ref({}) const formView = ref({})
function updateView() {} function updateView() {}
@ -327,7 +329,7 @@ watch(
@end="drag = false" @end="drag = false"
> >
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="nc-editable item cursor-pointer hover:bg-primary/10 pa-3"> <div class="nc-editable item cursor-pointer hover:bg-primary/10 pa-3" @click="activeRow = element.title">
<div class="flex"> <div class="flex">
<div class="flex flex-1"> <div class="flex flex-1">
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(element)" :column="element" /> <SmartsheetHeaderVirtualCell v-if="isVirtualCol(element)" :column="element" />
@ -337,12 +339,27 @@ watch(
<MdiHideIcon class="opacity-0 nc-field-remove-icon" @click.stop="hideColumn(index)" /> <MdiHideIcon class="opacity-0 nc-field-remove-icon" @click.stop="hideColumn(index)" />
</div> </div>
</div> </div>
<div <div class="nc-input">
class="w-full !bg-white rounded px-1 min-h-[40px] mt-2 mb-4 pa-2 flex align-center border-solid border-1 border-primary"
>
<SmartsheetVirtualCell v-if="isVirtualCol(element)" v-model="formState[element.title]" :column="element" /> <SmartsheetVirtualCell v-if="isVirtualCol(element)" v-model="formState[element.title]" :column="element" />
<SmartsheetCell v-else v-model="formState[element.title]" :column="element" :edit-enabled="true" /> <SmartsheetCell v-else v-model="formState[element.title]" :column="element" :edit-enabled="true" />
</div> </div>
<div v-if="activeRow === element.title" class="">
<a-input v-model:value="element.label" class="nc-input" size="large" :placeholder="$t('msg.info.formInput')">
</a-input>
<a-input
v-model:value="element.description"
class="nc-input"
:placeholder="$t('msg.info.formHelpText')"
size="large"
/>
<a-switch
v-model:checked="element.required"
class="mb-2"
:checked-children="$t('general.required')"
un-checked-children="Not Required"
></a-switch>
</div>
</div> </div>
</template> </template>
<template #footer> <template #footer>
@ -400,4 +417,8 @@ watch(
@apply opacity-100; @apply opacity-100;
} }
} }
.nc-input {
@apply w-full !bg-white rounded px-2 min-h-[40px] mt-2 mb-2 pa-2 flex align-center border-solid border-1 border-primary;
}
</style> </style>

Loading…
Cancel
Save