Browse Source

fix: refactor inline functions

pull/6486/head
sreehari jayaraj 12 months ago
parent
commit
e5f7125590
  1. 20
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 20
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

20
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -323,21 +323,11 @@ const onDeleteRowClick = () => {
}
const onConfirmDeleteRowClick = async () => {
try {
showDeleteRowModal.value = false
message.success('Row deleted')
await deleteRowById(primaryKey.value)
// if (!props.lastRow) {
// await onNext()
// } else if (!props.firstRow) {
// emits('prev')
// } else {
// }
reloadTrigger.trigger()
onClose()
} finally {
showDeleteRowModal.value = false
}
showDeleteRowModal.value = false
await deleteRowById(primaryKey.value)
reloadTrigger.trigger()
onClose()
showDeleteRowModal.value = false
}
watch(

20
packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

@ -127,6 +127,15 @@ onKeyStroke('Escape', () => {
const isDataExist = computed<boolean>(() => {
return childrenList.value?.pageInfo?.totalRows || (isNew.value && state.value?.[colTitle.value]?.length)
})
const linkOrUnLink = (rowRef: Record<string, string>, id: string) => {
if (isPublic.value && !isForm.value) return
isNew.value
? unlinkRow(rowRef, parseInt(id))
: isChildrenListLinked.value[parseInt(id)]
? unlinkRow(rowRef, parseInt(id))
: linkRow(rowRef, parseInt(id))
}
</script>
<template>
@ -220,16 +229,7 @@ const isDataExist = computed<boolean>(() => {
:is-linked="childrenList?.list ? isChildrenListLinked[Number.parseInt(id)] : true"
:is-loading="isChildrenListLoading[Number.parseInt(id)]"
@expand="onClick(refRow)"
@click="
() => {
if (isPublic && !isForm) return
isNew
? unlinkRow(refRow, parseInt(id))
: isChildrenListLinked[parseInt(id)]
? unlinkRow(refRow, parseInt(id))
: linkRow(refRow, parseInt(id))
}
"
@click="linkOrUnLink(refRow, id)"
/>
</template>
</div>

Loading…
Cancel
Save