Browse Source

fix(gui-v2): conditional drag & wait for form view result

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

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

@ -55,8 +55,8 @@ const {
updateRowProperty, updateRowProperty,
} = useViewData(meta, view as any) } = useViewData(meta, view as any)
const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, false, () => { const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, false, async () => {
loadFormView() await loadFormView()
setFormData() setFormData()
}) })
@ -155,7 +155,7 @@ function onMove(event: any) {
function hideColumn(idx: number) { function hideColumn(idx: number) {
if (isDbRequired(localColumns.value[idx]) || localColumns.value[idx].required) { if (isDbRequired(localColumns.value[idx]) || localColumns.value[idx].required) {
toast.info("Required field can't be removed") toast.info("Required field can't be moved")
return return
} }
@ -174,7 +174,6 @@ function hideColumn(idx: number) {
async function addAllColumns() { async function addAllColumns() {
for (const col of (formColumnData as Record<string, any>)?.value) { for (const col of (formColumnData as Record<string, any>)?.value) {
if (!systemFieldsIds.value.includes(col.fk_column_id)) { if (!systemFieldsIds.value.includes(col.fk_column_id)) {
console.log(col)
col.show = true col.show = true
} }
} }
@ -381,6 +380,7 @@ watch(
draggable=".item" draggable=".item"
group="form-inputs" group="form-inputs"
class="h-100" class="h-100"
filter=".disable-drag"
@change="onMove($event)" @change="onMove($event)"
@start="drag = true" @start="drag = true"
@end="drag = false" @end="drag = false"
@ -389,6 +389,7 @@ watch(
<div <div
ref="rowRef" ref="rowRef"
class="nc-editable item cursor-pointer hover:bg-primary/10 pa-3" class="nc-editable item cursor-pointer hover:bg-primary/10 pa-3"
:class="{ 'disable-drag': isDbRequired(element) || element.required }"
@click="activeRow = element.title" @click="activeRow = element.title"
> >
<div class="flex"> <div class="flex">
@ -404,7 +405,7 @@ watch(
:required="isRequired(element, element.required)" :required="isRequired(element, element.required)"
/> />
</div> </div>
<div v-if="isUIAllowed('editFormView')" class="flex"> <div v-if="isUIAllowed('editFormView') && !isRequired(element, element.required)" class="flex">
<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>

Loading…
Cancel
Save