Browse Source

fix: refactor inline functions

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

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

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

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

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

Loading…
Cancel
Save