Browse Source

fix/pr review included

pull/3225/head
Muhammed Mustafa 2 years ago
parent
commit
41b9971cf3
  1. 10
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue
  2. 2
      packages/nc-gui-v2/composables/useViewData.ts

10
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue

@ -1,9 +1,14 @@
<script setup lang="ts">
import { OpenNewRecordFormHookInj, inject } from '#imports'
const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' })
const isLocked = inject(IsLockedInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)!
const onClick = () => {
if (!isLocked) openNewRecordFormHook.trigger()
}
</script>
<template>
@ -13,10 +18,7 @@ const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)!
:class="{ 'hover:after:bg-primary/75 group': !isLocked, 'disabled-ring': isLocked }"
class="nc-sidebar-right-item nc-sidebar-add-row"
>
<MdiPlusOutline
:class="{ 'cursor-pointer group-hover:(!text-white)': !isLocked, 'disabled': isLocked }"
@click="!isLocked ? openNewRecordFormHook.trigger() : {}"
/>
<MdiPlusOutline :class="{ 'cursor-pointer group-hover:(!text-white)': !isLocked, 'disabled': isLocked }" @click="onClick" />
</div>
</a-tooltip>
</template>

2
packages/nc-gui-v2/composables/useViewData.ts

@ -214,11 +214,13 @@ export function useViewData(
oldRow: {},
rowMeta: { new: true },
})
return formattedData.value[addAfter]
}
const removeLastEmptyRow = () => {
const lastRow = formattedData.value[formattedData.value.length - 1]
if (lastRow.rowMeta.new) {
formattedData.value.pop()
}

Loading…
Cancel
Save